mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-16 18:24:45 +03:00
MODIFY Image.py save() -> ADD convert JPG->JPEG code
This commit is contained in:
parent
9bbf56b368
commit
d19fa7107d
|
@ -97,7 +97,7 @@ try:
|
||||||
# import Image and use the Image.core variable instead.
|
# import Image and use the Image.core variable instead.
|
||||||
# Also note that Image.core is not a publicly documented interface,
|
# Also note that Image.core is not a publicly documented interface,
|
||||||
# and should be considered private and subject to change.
|
# and should be considered private and subject to change.
|
||||||
from . import _imaging as core
|
from .. import _imaging as core
|
||||||
|
|
||||||
if __version__ != getattr(core, "PILLOW_VERSION", None):
|
if __version__ != getattr(core, "PILLOW_VERSION", None):
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
|
@ -225,6 +225,10 @@ OPEN = {}
|
||||||
MIME = {}
|
MIME = {}
|
||||||
SAVE = {}
|
SAVE = {}
|
||||||
SAVE_ALL = {}
|
SAVE_ALL = {}
|
||||||
|
# Convert jpg to jpeg, Can apply other case.
|
||||||
|
FORMAT_MAP = {
|
||||||
|
'JPG': 'jpeg',
|
||||||
|
}
|
||||||
EXTENSION = {}
|
EXTENSION = {}
|
||||||
DECODERS = {}
|
DECODERS = {}
|
||||||
ENCODERS = {}
|
ENCODERS = {}
|
||||||
|
@ -2332,6 +2336,7 @@ class Image:
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
raise ValueError(f"unknown file extension: {ext}") from e
|
raise ValueError(f"unknown file extension: {ext}") from e
|
||||||
|
|
||||||
|
format = FORMAT_MAP.get(format.upper(), format)
|
||||||
if format.upper() not in SAVE:
|
if format.upper() not in SAVE:
|
||||||
init()
|
init()
|
||||||
if save_all:
|
if save_all:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user