From 7e1261c6a0001c2302d391da24a44e2b5d669b57 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 27 Jul 2022 22:18:39 +1000 Subject: [PATCH 1/2] Simplified test code --- .../images/xmp_tags_orientation_exiftool.png | Bin 1935 -> 1258 bytes Tests/test_imageops.py | 16 +++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Tests/images/xmp_tags_orientation_exiftool.png b/Tests/images/xmp_tags_orientation_exiftool.png index fb30199c86acbc8953d1cf16ddfa9e3ec41ece19..10f0f44009ae9237c1a5712ae8b0c7269b527711 100644 GIT binary patch literal 1258 zcmbtUO=uHA6rN($novXq`-gO`;GVjFO|jV~DKV)grKy@mnu=s}AL+KVR@ylDkNREki%i75Ie4RNh42p)E4-uJ%wX1=%ccJlDR z!FpG-3n5e=jfCSclDVsH6THt0&mY22n+?W-2+dt^f0s5wOr;|67(%7J2u++t=o>&2 zpAZ`75Ly~RNW6+rgFf@%hz}B5^vJM@kb4JtYS8pdBSIUN>hyjw(_Xi(;=WXA+v0r+9(!cxVtY(it%xK2VW> z$WM=1mM*evp-^B79gJpVS>EgQvYfyQLOU?p&7x{acDris0R#cAkz!yu5IE?+fSxe5WW0qtbW=ROn6y3mP*+Hj|{R<<9 zFN22+8AItwkpmqSq7$nUlV9m7e^a2<#IoWG7f<4zI;@g8x-E zxX)`}5nIw7MFW}`GO%Q62D!|E^2b(4NOdp*18!F{$oUBt)6#OL7?vy?5IEi=@|?(Z zQCugPbakz)b8yx)vvMtl)CbuW$7~h5p9Ta4^x>bn4=17usDH zT3r0`vte^Cb2518`jfjiw?`gvp35)47H2=-Ug&G7ZR_g`-q`iNd)u*RCw8(;^K;YQ zd#Q!D?rR@Ed}*yunypi9$0x50ox9&W*uV6q``sOWs(rcjMGfBC(%^no^pHPFw09sp IyMN@&FNzYMoB#j- delta 1598 zcmV-E2EqC236BpYiBL{Q4GJ0x0000DNk~Le0001h0000$2m$~A09~}`C;$KfiIH}Y z0y8j^2mx)A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*qoM6N<$f|I@g`~Uy| diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index 95b49596e79..bd5f44e5008 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -345,18 +345,12 @@ def check(orientation_im): check(orientation_im) # Orientation from "XML:com.adobe.xmp" info key - with Image.open("Tests/images/xmp_tags_orientation.png") as im: - assert im.getexif()[0x0112] == 3 - - transposed_im = ImageOps.exif_transpose(im) - assert 0x0112 not in transposed_im.getexif() + for suffix in ("", "_exiftool"): + with Image.open("Tests/images/xmp_tags_orientation" + suffix + ".png") as im: + assert im.getexif()[0x0112] == 3 - # Orientation from "XML:com.adobe.xmp" info key (from exiftool) - with Image.open("Tests/images/xmp_tags_orientation_exiftool.png") as im: - assert im.getexif()[0x0112] == 8 - - transposed_im = ImageOps.exif_transpose(im) - assert 0x0112 not in transposed_im.getexif() + transposed_im = ImageOps.exif_transpose(im) + assert 0x0112 not in transposed_im.getexif() # Orientation from "Raw profile type exif" info key # This test image has been manually hexedited from exif_imagemagick.png From bac83f7dd3ac738f8bc16a6647f69f373916ae2b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 27 Jul 2022 22:27:43 +1000 Subject: [PATCH 2/2] Check that orientation is still absent after reloading Exif --- Tests/test_imageops.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index bd5f44e5008..01e40e6d4d5 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -352,6 +352,9 @@ def check(orientation_im): transposed_im = ImageOps.exif_transpose(im) assert 0x0112 not in transposed_im.getexif() + transposed_im._reload_exif() + assert 0x0112 not in transposed_im.getexif() + # Orientation from "Raw profile type exif" info key # This test image has been manually hexedited from exif_imagemagick.png # to have a different orientation