From 7405635b7245d0ab09d3b8ff34cd11bd0601cb63 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Tue, 30 May 2023 07:10:32 +0200 Subject: [PATCH] only check whether icc profile can be dropped if there is any --- src/img2pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index 00f6231..a25dfff 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -1434,7 +1434,7 @@ def get_imgmetadata( iccp = imgdata.info.get("icc_profile") # GIMP saves bilevel tiff images with an RGB ICC profile which # is useless and produces an error in Adobe Acrobat -- ignore it - if color == Colorspace["1"] and imgformat == ImageFormat.TIFF: + if iccp is not None and color == Colorspace["1"] and imgformat == ImageFormat.TIFF: with io.BytesIO(imgdata.info.get("icc_profile")) as f: prf = ImageCms.ImageCmsProfile(f) if (