mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-14 01:04:45 +03:00
Change exif behaviour of plugins for jpeg, tiff and webp to the behaviour of png plugin, i.e. use im.info.get("exif") as a fallback for im.encoderinfo.get("exif")
This commit is contained in:
parent
f4b1244213
commit
825a54ca31
|
@ -746,7 +746,7 @@ def _save(im, fp, filename):
|
|||
|
||||
optimize = info.get("optimize", False)
|
||||
|
||||
exif = info.get("exif", b"")
|
||||
exif = info.get("exif", im.info.get("exif", b""))
|
||||
if isinstance(exif, Image.Exif):
|
||||
exif = exif.tobytes()
|
||||
|
||||
|
|
|
@ -1601,14 +1601,13 @@ def _save(im, fp, filename):
|
|||
# write any arbitrary tags passed in as an ImageFileDirectory
|
||||
if "tiffinfo" in encoderinfo:
|
||||
info = encoderinfo["tiffinfo"]
|
||||
elif "exif" in encoderinfo:
|
||||
info = encoderinfo["exif"]
|
||||
else:
|
||||
info = encoderinfo.get("exif", im.info.get("exif", b""))
|
||||
if isinstance(info, bytes):
|
||||
exif = Image.Exif()
|
||||
exif.load(info)
|
||||
info = exif
|
||||
else:
|
||||
info = {}
|
||||
|
||||
logger.debug("Tiffinfo Keys: %s" % list(info))
|
||||
if isinstance(info, ImageFileDirectory_v1):
|
||||
info = info.to_v2()
|
||||
|
|
|
@ -320,7 +320,7 @@ def _save(im, fp, filename):
|
|||
lossless = im.encoderinfo.get("lossless", False)
|
||||
quality = im.encoderinfo.get("quality", 80)
|
||||
icc_profile = im.encoderinfo.get("icc_profile") or ""
|
||||
exif = im.encoderinfo.get("exif", b"")
|
||||
exif = im.encoderinfo.get("exif", im.info.get("exif", b""))
|
||||
if isinstance(exif, Image.Exif):
|
||||
exif = exif.tobytes()
|
||||
if exif.startswith(b"Exif\x00\x00"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user