mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Do not save EXIF from info
This commit is contained in:
parent
edcfe09f12
commit
88f15eb9f0
|
@ -706,10 +706,18 @@ class TestFilePng:
|
|||
assert exif[274] == 3
|
||||
|
||||
def test_exif_save(self, tmp_path):
|
||||
with Image.open("Tests/images/exif.png") as im:
|
||||
# Test exif is not saved from info
|
||||
test_file = str(tmp_path / "temp.png")
|
||||
with Image.open("Tests/images/exif.png") as im:
|
||||
im.save(test_file)
|
||||
|
||||
with Image.open(test_file) as reloaded:
|
||||
assert reloaded._getexif() is None
|
||||
|
||||
# Test passing in exif
|
||||
with Image.open("Tests/images/exif.png") as im:
|
||||
im.save(test_file, exif=im.getexif())
|
||||
|
||||
with Image.open(test_file) as reloaded:
|
||||
exif = reloaded._getexif()
|
||||
assert exif[274] == 1
|
||||
|
@ -720,7 +728,7 @@ class TestFilePng:
|
|||
def test_exif_from_jpg(self, tmp_path):
|
||||
with Image.open("Tests/images/pil_sample_rgb.jpg") as im:
|
||||
test_file = str(tmp_path / "temp.png")
|
||||
im.save(test_file)
|
||||
im.save(test_file, exif=im.getexif())
|
||||
|
||||
with Image.open(test_file) as reloaded:
|
||||
exif = reloaded._getexif()
|
||||
|
|
|
@ -1383,7 +1383,7 @@ def _save(im, fp, filename, chunk=putchunk, save_all=False):
|
|||
chunks.remove(cid)
|
||||
chunk(fp, cid, data)
|
||||
|
||||
exif = im.encoderinfo.get("exif", im.info.get("exif"))
|
||||
exif = im.encoderinfo.get("exif")
|
||||
if exif:
|
||||
if isinstance(exif, Image.Exif):
|
||||
exif = exif.tobytes(8)
|
||||
|
|
Loading…
Reference in New Issue
Block a user