Skip to content

Commit 9f654ff

Browse files
authored
Fixed conversion of AVIF image rotation property to EXIF orientation (#8866)
1 parent 9f41957 commit 9f654ff

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Tests/test_file_avif.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def test_exif(self) -> None:
309309
assert exif[274] == 3
310310

311311
@pytest.mark.parametrize("use_bytes", [True, False])
312-
@pytest.mark.parametrize("orientation", [1, 2])
312+
@pytest.mark.parametrize("orientation", [1, 2, 3, 4, 5, 6, 7, 8])
313313
def test_exif_save(
314314
self,
315315
tmp_path: Path,
@@ -327,6 +327,7 @@ def test_exif_save(
327327
if orientation == 1:
328328
assert "exif" not in reloaded.info
329329
else:
330+
assert reloaded.getexif()[274] == orientation
330331
assert reloaded.info["exif"] == exif_data
331332

332333
def test_exif_without_orientation(self, tmp_path: Path) -> None:

src/_avif.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ irot_imir_to_exif_orientation(const avifImage *image) {
5959
return axis ? 7 // 90 degrees anti-clockwise then swap left and right.
6060
: 5; // 90 degrees anti-clockwise then swap top and bottom.
6161
}
62-
return 6; // 90 degrees anti-clockwise.
62+
return 8; // 90 degrees anti-clockwise.
6363
}
6464
if (angle == 2) {
6565
if (imir) {
@@ -75,7 +75,7 @@ irot_imir_to_exif_orientation(const avifImage *image) {
7575
? 5 // 270 degrees anti-clockwise then swap left and right.
7676
: 7; // 270 degrees anti-clockwise then swap top and bottom.
7777
}
78-
return 8; // 270 degrees anti-clockwise.
78+
return 6; // 270 degrees anti-clockwise.
7979
}
8080
}
8181
if (imir) {

0 commit comments

Comments
 (0)