Slightly simplify imgformat retrieval #201

Open
mara0004 wants to merge 2 commits from mara0004/img2pdf:imgformat into main
Showing only changes of commit 2b563c0982 - Show all commits

View file

@ -1832,10 +1832,7 @@ def read_images(
) )
else: else:
logger.debug("PIL format = %s", imgdata.format) logger.debug("PIL format = %s", imgdata.format)
try: imgformat = getattr(ImageFormat, imgdata.format, ImageFormat.other)
imgformat = ImageFormat[imgdata.format]
except KeyError:
imgformat = ImageFormat.other
def cleanup(): def cleanup():
if imgdata is not None: if imgdata is not None: