aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFPageObjectHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-01-26 21:07:18 +0100
committerJay Berkenbilt <ejb@ql.org>2020-01-26 21:29:10 +0100
commitbbc2f8ffae939eab598f583514fb132d23c11705 (patch)
tree6ada4c02275422ea723ec89278dc7c52795a79c7 /libqpdf/QPDFPageObjectHelper.cc
parent12777a04ca85e69a26732bfa8604af8d23f8bfe1 (diff)
downloadqpdf-bbc2f8ffae939eab598f583514fb132d23c11705.tar.zst
Bug fix: handle ColorSpace lookup for inline images (fixes #392)
If the value of /CS in the inline image dictionary was is key in the page's /Resource -> /ColorSpace dictionary, properly resolve it by referencing the proper colorspace, and not just the name, in the external image dictionary.
Diffstat (limited to 'libqpdf/QPDFPageObjectHelper.cc')
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc
index d588c322..01f1d662 100644
--- a/libqpdf/QPDFPageObjectHelper.cc
+++ b/libqpdf/QPDFPageObjectHelper.cc
@@ -141,6 +141,22 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
}
else
{
+ // This is a key in the page's /Resources ->
+ // /ColorSpace dictionary. We need to look it up
+ // and use its value as the color space for the
+ // image.
+ QPDFObjectHandle colorspace =
+ resources.getKey("/ColorSpace");
+ if (colorspace.isDictionary() && colorspace.hasKey(name))
+ {
+ QTC::TC("qpdf", "QPDFPageObjectHelper colorspace lookup");
+ value = colorspace.getKey(name);
+ }
+ else
+ {
+ resources.warnIfPossible(
+ "unable to resolve colorspace " + name);
+ }
name.clear();
}
if (! name.empty())