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 8, 2023
1 parent 52c6d68 commit ea953c0
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,20 +1203,6 @@ 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

# allow closing if we're on the first frame, there's no next
# This is the ImageFile.load path only, libtiff specific below.
if not self.is_animated:
Expand All @@ -1233,6 +1219,8 @@ def load_end(self):
continue
exif.get_ifd(key)

ImageOps.exif_transpose(self, in_place=True)

def _load_libtiff(self):
"""Overload method triggered when we detect a compressed tiff
Calls out to libtiff"""
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 ea953c0

Please sign in to comment.