From cf4b04c5d163a3b661f45ae8783ca1bbf9baf3ab Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Wed, 11 Sep 2019 12:56:27 -0700 Subject: [PATCH] optimize: work around pikepdf 1.6.3 limitation with indexed ICCbased colorspaces --- src/ocrmypdf/optimize.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ocrmypdf/optimize.py b/src/ocrmypdf/optimize.py index 2976554c..bfe027af 100644 --- a/src/ocrmypdf/optimize.py +++ b/src/ocrmypdf/optimize.py @@ -111,6 +111,11 @@ def extract_image_generic(*, pike, root, log, image, xref, options): if pim.bits_per_component == 1: return None + try: + pim.indexed # pikepdf 1.6.3 can't handle [/Indexed [/Array...]] + except NotImplementedError: + return None + if filtdp[0] == Name.DCTDecode and options.optimize >= 2: # This is a simple heuristic derived from some training data, that has # about a 70% chance of guessing whether the JPEG is high quality,