From 2f736d7891515f601137a23c6ae5b1cb9fcd0267 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 6 Aug 2023 19:43:19 +0200 Subject: [PATCH] allow 'matte' to be missing in MIFF --- src/img2pdf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index ebff595..904b647 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -1696,7 +1696,7 @@ def parse_miff(data): elif hdata["colorspace"] == "Gray": numchannels = 1 colorspace = Colorspace.L - if hdata["matte"]: + if hdata.get("matte"): numchannels += 1 if hdata.get("profile"): # there is no key encoding the length of icc or exif data @@ -1746,7 +1746,7 @@ def parse_miff(data): # case "PseudoClass": elif hdata["class"] == "PseudoClass": assert "colors" in hdata - if hdata["matte"]: + if hdata.get("matte"): numchannels = 2 else: numchannels = 1