mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #6582 from radarhere/webp_exif
Removed EXIF prefix when saving WebP
This commit is contained in:
commit
4995d045dc
|
@ -55,9 +55,7 @@ def test_write_exif_metadata():
|
||||||
test_buffer.seek(0)
|
test_buffer.seek(0)
|
||||||
with Image.open(test_buffer) as webp_image:
|
with Image.open(test_buffer) as webp_image:
|
||||||
webp_exif = webp_image.info.get("exif", None)
|
webp_exif = webp_image.info.get("exif", None)
|
||||||
assert webp_exif
|
assert webp_exif == expected_exif[6:], "WebP EXIF didn't match"
|
||||||
if webp_exif:
|
|
||||||
assert webp_exif == expected_exif, "WebP EXIF didn't match"
|
|
||||||
|
|
||||||
|
|
||||||
def test_read_icc_profile():
|
def test_read_icc_profile():
|
||||||
|
|
|
@ -311,9 +311,11 @@ def _save(im, fp, filename):
|
||||||
lossless = im.encoderinfo.get("lossless", False)
|
lossless = im.encoderinfo.get("lossless", False)
|
||||||
quality = im.encoderinfo.get("quality", 80)
|
quality = im.encoderinfo.get("quality", 80)
|
||||||
icc_profile = im.encoderinfo.get("icc_profile") or ""
|
icc_profile = im.encoderinfo.get("icc_profile") or ""
|
||||||
exif = im.encoderinfo.get("exif", "")
|
exif = im.encoderinfo.get("exif", b"")
|
||||||
if isinstance(exif, Image.Exif):
|
if isinstance(exif, Image.Exif):
|
||||||
exif = exif.tobytes()
|
exif = exif.tobytes()
|
||||||
|
if exif.startswith(b"Exif\x00\x00"):
|
||||||
|
exif = exif[6:]
|
||||||
xmp = im.encoderinfo.get("xmp", "")
|
xmp = im.encoderinfo.get("xmp", "")
|
||||||
method = im.encoderinfo.get("method", 4)
|
method = im.encoderinfo.get("method", 4)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user