Skip to content

Commit

Permalink
transpose
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 29, 2021
1 parent 622ba12 commit 7d9504e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Tests/test_imageops.py
Expand Up @@ -270,25 +270,29 @@ def test_colorize_3color_offset():


def test_exif_transpose():
exts = [".jpg"]
exts = [".jpg", ".tif"]
if features.check("webp") and features.check("webp_anim"):
exts.append(".webp")
for ext in exts:
with Image.open("Tests/images/hopper" + ext) as base_im:

def check(orientation_im):
for im in [
orientation_im,
orientation_im.copy(),
]: # ImageFile # Image
if orientation_im is base_im:
assert "exif" not in im.info
ims = [orientation_im] # ImageFile
if ext == ".tif":
ims.append(orientation_im.copy()) # Image
for im in ims:
if ext == ".tif":
original_exif = im.getexif()
else:
original_exif = im.info["exif"]
if orientation_im is base_im:
assert "exif" not in im.info
else:
original_exif = im.info["exif"]
transposed_im = ImageOps.exif_transpose(im)
assert_image_similar(base_im, transposed_im, 17)
if orientation_im is base_im:
assert "exif" not in im.info
if ext != ".tif":
assert "exif" not in im.info
else:
assert transposed_im.info["exif"] != original_exif

Expand Down

0 comments on commit 7d9504e

Please sign in to comment.