From 0d6ef430def82ef68ca09d2f2191fac43314afaf Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 17 Apr 2018 23:38:00 -0700 Subject: [PATCH] optimize: fix "length not defined" --- src/ocrmypdf/_optimize.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ocrmypdf/_optimize.py b/src/ocrmypdf/_optimize.py index 850e66ca..03924b96 100644 --- a/src/ocrmypdf/_optimize.py +++ b/src/ocrmypdf/_optimize.py @@ -97,11 +97,12 @@ def extract_images(doc, pike, root, log): cs = image.get('/ColorSpace', '') w = int(image.Width) h = int(image.Height) - if len(filt) == 1: - filt = filt[0] - else: - log.debug("Skipping multiply filtered {}".format(filt)) - continue # Not supported: multiple filters + if filt.type_code == pikepdf.ObjectType.array: + if len(filt) == 1: + filt = filt[0] + else: + log.debug("Skipping multiply filtered {}".format(filt)) + continue # Not supported: multiple filters if bpc == 1 and filt != '/JBIG2Decode': decode_parms = image.get('/DecodeParms') if filt == '/CCITTFaxDecode':