Skip to content

Commit

Permalink
When TIFF applies orientation on load, delete tag from getexif()
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 7, 2023
1 parent 52c6d68 commit a0f413b
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,19 +1203,7 @@ def load(self):
return super().load()

def load_end(self):
if self._tile_orientation:
method = {
2: Image.Transpose.FLIP_LEFT_RIGHT,
3: Image.Transpose.ROTATE_180,
4: Image.Transpose.FLIP_TOP_BOTTOM,
5: Image.Transpose.TRANSPOSE,
6: Image.Transpose.ROTATE_270,
7: Image.Transpose.TRANSVERSE,
8: Image.Transpose.ROTATE_90,
}.get(self._tile_orientation)
if method is not None:
self.im = self.im.transpose(method)
self._size = self.im.size
ImageOps.exif_transpose(self, in_place=True)

# allow closing if we're on the first frame, there's no next
# This is the ImageFile.load path only, libtiff specific below.
Expand Down Expand Up @@ -1542,8 +1530,6 @@ def _setup(self):
palette = [o8(b // 256) for b in self.tag_v2[COLORMAP]]
self.palette = ImagePalette.raw("RGB;L", b"".join(palette))

self._tile_orientation = self.tag_v2.get(ExifTags.Base.Orientation)


#
# --------------------------------------------------------------------
Expand Down

0 comments on commit a0f413b

Please sign in to comment.