diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 1f8aea50..418da7f1 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -3548,16 +3548,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next) bool ImageOptimizer::evaluate(std::string const& description) { - Pl_Discard d; - Pl_Count c("count", &d); - PointerHolder p = makePipeline(description, &c); - if (p.getPointer() == 0) - { - // message issued by makePipeline - return false; - } - if (! image.pipeStreamData(p.getPointer(), 0, qpdf_dl_specialized, - true, false)) + if (! image.pipeStreamData(0, 0, qpdf_dl_specialized, true)) { QTC::TC("qpdf", "qpdf image optimize no pipeline"); if (o.verbose) @@ -3569,6 +3560,18 @@ ImageOptimizer::evaluate(std::string const& description) } return false; } + Pl_Discard d; + Pl_Count c("count", &d); + PointerHolder p = makePipeline(description, &c); + if (p.getPointer() == 0) + { + // message issued by makePipeline + return false; + } + if (! image.pipeStreamData(p.getPointer(), 0, qpdf_dl_specialized)) + { + return false; + } long long orig_length = image.getDict().getKey("/Length").getIntValue(); if (c.getCount() >= orig_length) {