Slightly simplify imgformat retrieval #201

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

View file

@ -1832,11 +1832,9 @@ def read_images(
) )
else: else:
logger.debug("PIL format = %s", imgdata.format) logger.debug("PIL format = %s", imgdata.format)
imgformat = None try:
for f in ImageFormat: imgformat = ImageFormat[imgdata.format]
if f.name == imgdata.format: except KeyError:
imgformat = f
if imgformat is None:
imgformat = ImageFormat.other imgformat = ImageFormat.other
def cleanup(): def cleanup():