Fixed conversion of AVIF image rotation property to EXIF orientation (#8866)

This commit is contained in:
Frankie Dintino 2025-04-04 09:41:11 -04:00 committed by GitHub
parent 9f4195752d
commit 9f654ff748
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -309,7 +309,7 @@ class TestFileAvif:
assert exif[274] == 3 assert exif[274] == 3
@pytest.mark.parametrize("use_bytes", [True, False]) @pytest.mark.parametrize("use_bytes", [True, False])
@pytest.mark.parametrize("orientation", [1, 2]) @pytest.mark.parametrize("orientation", [1, 2, 3, 4, 5, 6, 7, 8])
def test_exif_save( def test_exif_save(
self, self,
tmp_path: Path, tmp_path: Path,
@ -327,6 +327,7 @@ class TestFileAvif:
if orientation == 1: if orientation == 1:
assert "exif" not in reloaded.info assert "exif" not in reloaded.info
else: else:
assert reloaded.getexif()[274] == orientation
assert reloaded.info["exif"] == exif_data assert reloaded.info["exif"] == exif_data
def test_exif_without_orientation(self, tmp_path: Path) -> None: def test_exif_without_orientation(self, tmp_path: Path) -> None:

View File

@ -59,7 +59,7 @@ irot_imir_to_exif_orientation(const avifImage *image) {
return axis ? 7 // 90 degrees anti-clockwise then swap left and right. return axis ? 7 // 90 degrees anti-clockwise then swap left and right.
: 5; // 90 degrees anti-clockwise then swap top and bottom. : 5; // 90 degrees anti-clockwise then swap top and bottom.
} }
return 6; // 90 degrees anti-clockwise. return 8; // 90 degrees anti-clockwise.
} }
if (angle == 2) { if (angle == 2) {
if (imir) { if (imir) {
@ -75,7 +75,7 @@ irot_imir_to_exif_orientation(const avifImage *image) {
? 5 // 270 degrees anti-clockwise then swap left and right. ? 5 // 270 degrees anti-clockwise then swap left and right.
: 7; // 270 degrees anti-clockwise then swap top and bottom. : 7; // 270 degrees anti-clockwise then swap top and bottom.
} }
return 8; // 270 degrees anti-clockwise. return 6; // 270 degrees anti-clockwise.
} }
} }
if (imir) { if (imir) {