From 0b24f971cd7f38984696d2eccc9ea9d348f88473 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 2 Aug 2016 01:22:36 -0700 Subject: [PATCH] ocrmyimage: complain about ICC profiles being presumed --- ocrmypdf/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ocrmypdf/main.py b/ocrmypdf/main.py index 1bc1e7b5..e42023e0 100755 --- a/ocrmypdf/main.py +++ b/ocrmypdf/main.py @@ -417,6 +417,14 @@ def triage_image_file(input_file, output_file, log): "in its metadata. Estimate the resolution at which " "image was scanned and specify it using --image-dpi.") sys.exit(ExitCode.input_file) + + if 'iccprofile' not in im.info: + if im.mode == 'RGB': + log.info('Input image has no ICC profile, assuming sRGB') + elif im.mode == 'CMYK': + log.info('Input CMYK image has no ICC profile, not usable') + sys.exit(ExitCode.input_file) + finally: im.close()