Skip to content

Commit

Permalink
Test getexif() change
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Nov 12, 2024
1 parent e02eaa4 commit 9d34d90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Tests/test_file_avif.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ def test_exif(self) -> None:
exif = im.getexif()
assert exif[274] == 1

with Image.open("Tests/images/avif/xmp_tags_orientation.avif") as im:
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")
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,8 @@ def getexif(self) -> Exif:

# XMP tags
if ExifTags.Base.Orientation not in self._exif:
xmp_tags = self.info.get("XML:com.adobe.xmp") or self.info.get("xmp")
if isinstance(xmp_tags, bytes):
xmp_tags = self.info.get("XML:com.adobe.xmp")
if not xmp_tags and (xmp_tags := self.info.get("xmp")):
xmp_tags = xmp_tags.decode("utf-8")
if xmp_tags:
match = re.search(r'tiff:Orientation(="|>)([0-9])', xmp_tags)
Expand Down

0 comments on commit 9d34d90

Please sign in to comment.