mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-01-28 11:05:49 +03:00
format overrides file extension when saving
This commit is contained in:
parent
a0f51493ca
commit
a6b36f0b6b
|
|
@ -2631,14 +2631,20 @@ class Image:
|
|||
# only set the name for metadata purposes
|
||||
filename = os.fspath(fp.name)
|
||||
|
||||
filename_ext = os.path.splitext(filename)[1].lower()
|
||||
ext = filename_ext.decode() if isinstance(filename_ext, bytes) else filename_ext
|
||||
|
||||
# Try importing only the plugin for this extension first
|
||||
if not _import_plugin_for_extension(ext):
|
||||
if format:
|
||||
preinit()
|
||||
else:
|
||||
filename_ext = os.path.splitext(filename)[1].lower()
|
||||
ext = (
|
||||
filename_ext.decode()
|
||||
if isinstance(filename_ext, bytes)
|
||||
else filename_ext
|
||||
)
|
||||
|
||||
# Try importing only the plugin for this extension first
|
||||
if not _import_plugin_for_extension(ext):
|
||||
preinit()
|
||||
|
||||
if not format:
|
||||
if ext not in EXTENSION:
|
||||
init()
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user