Slightly simplify imgformat retrieval

No need for a loop here - we can access the enum like a dictionary,
which should be more efficient.
This commit is contained in:
mara004 2024-08-25 17:43:53 +02:00
parent 819b366bf5
commit 132464c0a1

View file

@ -1832,11 +1832,9 @@ 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:
try:
imgformat = ImageFormat[imgdata.format]
except KeyError:
imgformat = ImageFormat.other
def cleanup():