mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Rearranged format handler fetching
This commit is contained in:
parent
be1df0f33c
commit
abe25b7191
|
@ -1682,14 +1682,9 @@ class Image(object):
|
|||
ext = os.path.splitext(filename)[1].lower()
|
||||
|
||||
if not format:
|
||||
try:
|
||||
format = EXTENSION[ext]
|
||||
except KeyError:
|
||||
if ext not in EXTENSION:
|
||||
init()
|
||||
try:
|
||||
format = EXTENSION[ext]
|
||||
except KeyError:
|
||||
raise KeyError(ext) # unknown extension
|
||||
format = EXTENSION[ext]
|
||||
|
||||
if format.upper() not in SAVE:
|
||||
init()
|
||||
|
|
Loading…
Reference in New Issue
Block a user