From 57ad405b8da9397320bfcb9d76a63e44266afa49 Mon Sep 17 00:00:00 2001 From: James R. Barlow Date: Mon, 15 Sep 2025 13:25:33 -0700 Subject: [PATCH] Avoid unnecessary re-compression in QPDFJob::doCheck --- libqpdf/QPDFJob.cc | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 560bead..81bded8 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -793,6 +793,11 @@ QPDFJob::doCheck(QPDF& pdf) Pl_Discard discard; w.setOutputPipeline(&discard); w.setDecodeLevel(qpdf_dl_all); + // Disable compression of streams, since we only need to confirm we can decode them. This + // avoids JPEG DCT -> Flate recompression of all images. + w.setCompressStreams(false); + // Also disable recompression of Flate streams since are only checking. + w.setRecompressFlate(false); w.write(); // Parse all content streams -- libgit2 0.21.4