Skip to content

Commit

Permalink
Added getxmp() to WebPImagePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Nov 24, 2022
1 parent f276316 commit f8ae3f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Tests/test_file_webp_metadata.py
Expand Up @@ -127,11 +127,14 @@ def test_write_animated_metadata(tmp_path):
exif=exif_data,
xmp=xmp_data,
)
assert "xmp" not in frame1.info
assert frame1.getxmp() == {}

with Image.open(temp_file) as image:
assert "icc_profile" in image.info
assert "exif" in image.info
assert "xmp" in image.info
assert iccp_data == image.info.get("icc_profile", None)
assert exif_data == image.info.get("exif", None)
assert xmp_data == image.info.get("xmp", None)
assert iccp_data == image.info["icc_profile"]
assert exif_data == image.info["exif"]
assert xmp_data == image.info["xmp"]
assert xmp_data == image.getxmp()
3 changes: 3 additions & 0 deletions src/PIL/WebPImagePlugin.py
Expand Up @@ -98,6 +98,9 @@ def _getexif(self):
return None
return self.getexif()._get_merged_dict()

def getxmp(self):
return self.info.get("xmp", {})

def seek(self, frame):
if not self._seek_check(frame):
return
Expand Down

0 comments on commit f8ae3f4

Please sign in to comment.