Skip to content

Commit

Permalink
Do not save XMP and EXIF data from info dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 7, 2024
1 parent 1c5b438 commit 1b67551
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions Tests/test_file_avif.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,6 @@ def test_exif(self) -> None:
exif = im.getexif()
assert exif[274] == 3

def test_exif_save_default(self, tmp_path: Path) -> None:
with Image.open("Tests/images/avif/exif.avif") as im:
test_file = str(tmp_path / "temp.avif")
im.save(test_file)

with Image.open(test_file) as reloaded:
exif = reloaded.getexif()
assert exif[274] == 1

@pytest.mark.parametrize("bytes", [True, False])
def test_exif_save_argument(self, tmp_path: Path, bytes: bool) -> None:
exif = Image.Exif()
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/AvifImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _save(
autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0))

icc_profile = info.get("icc_profile", im.info.get("icc_profile"))
exif = info.get("exif", im.info.get("exif"))
exif = info.get("exif")
if exif:
if isinstance(exif, Image.Exif):
exif_data = exif
Expand All @@ -180,7 +180,7 @@ def _save(
else:
exif_orientation = 1

xmp = info.get("xmp", im.info.get("xmp") or im.info.get("XML:com.adobe.xmp"))
xmp = info.get("xmp")

if isinstance(xmp, str):
xmp = xmp.encode("utf-8")
Expand Down

0 comments on commit 1b67551

Please sign in to comment.