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:
parent
23436114f8
commit
b6dbfdb481
1 changed files with 1 additions and 6 deletions
|
@ -1935,12 +1935,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:
|
||||
|
|
Loading…
Reference in a new issue