2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Add colorspace and depth information in json for images

This commit is contained in:
Jay Berkenbilt 2018-12-22 11:29:31 -05:00
parent 62ea3b9197
commit 86f9b4c43b

View File

@ -293,6 +293,9 @@ static JSON json_schema(std::set<std::string>* keys = 0)
JSON::makeString("reference to original page object")); JSON::makeString("reference to original page object"));
JSON image = page.addDictionaryMember("images", JSON::makeArray()). JSON image = page.addDictionaryMember("images", JSON::makeArray()).
addArrayElement(JSON::makeDictionary()); addArrayElement(JSON::makeDictionary());
image.addDictionaryMember(
"name",
JSON::makeString("name of image in XObject table"));
image.addDictionaryMember( image.addDictionaryMember(
"object", "object",
JSON::makeString("reference to image stream")); JSON::makeString("reference to image stream"));
@ -302,6 +305,12 @@ static JSON json_schema(std::set<std::string>* keys = 0)
image.addDictionaryMember( image.addDictionaryMember(
"height", "height",
JSON::makeString("image height")); JSON::makeString("image height"));
image.addDictionaryMember(
"colorspace",
JSON::makeString("color space"));
image.addDictionaryMember(
"bitspercomponent",
JSON::makeString("bits per component"));
image.addDictionaryMember("filter", JSON::makeArray()). image.addDictionaryMember("filter", JSON::makeArray()).
addArrayElement( addArrayElement(
JSON::makeString("filters applied to image data")); JSON::makeString("filters applied to image data"));
@ -2695,6 +2704,10 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j)
"width", dict.getKey("/Width").getJSON()); "width", dict.getKey("/Width").getJSON());
j_image.addDictionaryMember( j_image.addDictionaryMember(
"height", dict.getKey("/Height").getJSON()); "height", dict.getKey("/Height").getJSON());
j_image.addDictionaryMember(
"colorspace", dict.getKey("/ColorSpace").getJSON());
j_image.addDictionaryMember(
"bitspercomponent", dict.getKey("/BitsPerComponent").getJSON());
QPDFObjectHandle filters = dict.getKey("/Filter").wrapInArray(); QPDFObjectHandle filters = dict.getKey("/Filter").wrapInArray();
j_image.addDictionaryMember( j_image.addDictionaryMember(
"filter", filters.getJSON()); "filter", filters.getJSON());