mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Merge pull request #1321 from radarhere/handler
Rearranged format handler fetching
This commit is contained in:
commit
0d9d288a60
|
@ -1682,14 +1682,9 @@ class Image(object):
|
||||||
ext = os.path.splitext(filename)[1].lower()
|
ext = os.path.splitext(filename)[1].lower()
|
||||||
|
|
||||||
if not format:
|
if not format:
|
||||||
try:
|
if ext not in EXTENSION:
|
||||||
format = EXTENSION[ext]
|
|
||||||
except KeyError:
|
|
||||||
init()
|
init()
|
||||||
try:
|
|
||||||
format = EXTENSION[ext]
|
format = EXTENSION[ext]
|
||||||
except KeyError:
|
|
||||||
raise KeyError(ext) # unknown extension
|
|
||||||
|
|
||||||
if format.upper() not in SAVE:
|
if format.upper() not in SAVE:
|
||||||
init()
|
init()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user