diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-30 00:16:02 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-30 00:16:02 +0100 |
commit | 8d229e078f7e9f8af36ef983bb777c446aa5309b (patch) | |
tree | b67de4fc9c9edf4d9facf245d6f5fec43f0f1227 | |
parent | 8a9cfd2605dc6754d92b7b0ab849e082b77a78ae (diff) | |
download | qpdf-8d229e078f7e9f8af36ef983bb777c446aa5309b.tar.zst |
Improve info message in optimize images (fixes #280)
When qpdf can't optimize an image because of an unsupported color
space, state this specifically. Recognize that many valid colorspaces
are not represented as name objects.
-rw-r--r-- | qpdf/qpdf.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 55157af2..c26189de 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -3767,7 +3767,6 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) QPDFObjectHandle components_obj = dict.getKey("/BitsPerComponent"); if (! (w_obj.isInteger() && h_obj.isInteger() && - colorspace_obj.isName() && components_obj.isInteger())) { if (o.verbose && (! description.empty())) @@ -3780,7 +3779,9 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) } JDIMENSION w = w_obj.getIntValue(); JDIMENSION h = h_obj.getIntValue(); - std::string colorspace = colorspace_obj.getName(); + std::string colorspace = (colorspace_obj.isName() ? + colorspace_obj.getName() : + ""); int components = 0; J_COLOR_SPACE cs = JCS_UNKNOWN; if (colorspace == "/DeviceRGB") @@ -3803,8 +3804,8 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) if (o.verbose && (! description.empty())) { std::cout << whoami << ": " << description - << ": not optimizing because of unsupported" - << " image parameters" << std::endl; + << ": not optimizing because qpdf can't optimize" + << " images with this colorspace" << std::endl; } return result; } |