code: def test_exif_transpose():
      exts = [".jpg"]
      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
                      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
                      else:
                          assert (
                              transposed_im.info["exif"]
                              != original_exif
                          )
  
                          assert 0x0112 in im.getexif()
                          assert 0x0112 not in transposed_im.getexif()
  
                      # Repeat the operation to test that it does not keep transposing
                      transposed_im2 = ImageOps.exif_transpose(
                          transposed_im
                      )
                      assert_image_equal(transposed_im2, transposed_im)
  
              check(base_im)
              for i in range(2, 9):
                  with Image.open(
                      "Tests/images/hopper_orientation_" + str(i) + ext
                  ) as orientation_im:
                      check(orientation_im)
  
      # Orientation from "XML:com.adobe.xmp" info key
      for suffix in ("", "_exiftool"):
          with Image.open(
              "Tests/images/xmp_tags_orientation" + suffix + ".png"
          ) as im:
              assert im.getexif()[0x0112] == 3
  
              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
      with Image.open(
          "Tests/images/exif_imagemagick_orientation.png"
      ) as im:
          assert im.getexif()[0x0112] == 3
  
          transposed_im = ImageOps.exif_transpose(im)
          assert 0x0112 not in transposed_im.getexif()
  
      # Orientation set directly on Image.Exif
      im = hopper()
      im.getexif()[0x0112] = 3
      transposed_im = ImageOps.exif_transpose(im)
      assert 0x0112 not in transposed_im.getexif()
  
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageDraw, ImageOps, ImageStat, features
  from .helper import assert_image_equal, assert_image_similar, assert_image_similar_tofile, assert_tuple_approx_equal, hopper
label_desc: Use image node_id 16 for calling a global function with example usage: test_exif_transpose() without return types