From 7725d16a26eb7a25540110e80636ca1a87a725f2 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Thu, 24 Nov 2016 22:37:00 -0800 Subject: [PATCH] Fix exception on inline stencil masks with no /CS attribute --- ocrmypdf/pageinfo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocrmypdf/pageinfo.py b/ocrmypdf/pageinfo.py index 418ca991..24c96cdb 100644 --- a/ocrmypdf/pageinfo.py +++ b/ocrmypdf/pageinfo.py @@ -232,7 +232,10 @@ def _find_page_inline_images(page, pageinfo, contentsinfo): image['bpc'] = inline.settings['/BPC'] else: image['bpc'] = 8 - image['color'] = FRIENDLY_COLORSPACE.get(inline.settings['/CS'], '-') + if '/CS' in inline.settings: + image['color'] = FRIENDLY_COLORSPACE.get(inline.settings['/CS'], '-') + else: + image['color'] = '-' image['comp'] = FRIENDLY_COMP.get(image['color'], '?') if '/F' in inline.settings: filter_ = inline.settings['/F']