diff --git a/src/img2pdf.py b/src/img2pdf.py index f89670b..3b9ba99 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -1832,12 +1832,7 @@ def read_images( ) else: logger.debug("PIL format = %s", imgdata.format) - imgformat = None - for f in ImageFormat: - if f.name == imgdata.format: - imgformat = f - if imgformat is None: - imgformat = ImageFormat.other + imgformat = getattr(ImageFormat, imgdata.format, ImageFormat.other) def cleanup(): if imgdata is not None: