From 069ee6c91f398e61b8a328256a4a510ceaee3086 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 10 Sep 2018 23:09:51 -0700 Subject: [PATCH] ghostscript: fix for 9.24 having jpeg passthrough available --- src/ocrmypdf/exec/ghostscript.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ocrmypdf/exec/ghostscript.py b/src/ocrmypdf/exec/ghostscript.py index 1e88648a..aebc349a 100644 --- a/src/ocrmypdf/exec/ghostscript.py +++ b/src/ocrmypdf/exec/ghostscript.py @@ -33,14 +33,19 @@ def version(): def jpeg_passthrough_available(): """ - Ghostscript 9.23 introduced JPEG passthrough but it seems to corrupt the - last two bytes of certain images, for now we disable it for 9.23 and - do not mention it for < 9.23. + Returns True if the installed version of Ghostscript supports JPEG passthru + Prior to 9.23, Ghostscript decode and re-encoded JPEGs internally. In 9.23 + it gained the ability to keep JPEGs unmodified. However, the 9.23 + implementation was buggy and would deletes the last two bytes of images in + some cases, as reported here. https://bugs.ghostscript.com/show_bug.cgi?id=699216 + The issue was fixed for 9.24, hence that is the first version we consider + the feature available. + """ - return False + return version() >= '9.24' def _gs_error_reported(stream):