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
819b366bf5
commit
132464c0a1
1 changed files with 3 additions and 5 deletions
|
@ -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():
|
||||||
|
|
Loading…
Reference in a new issue