When TIFF applies orientation on load, delete tag from getexif()

This commit is contained in:
Andrew Murray 2023-09-08 15:05:36 +10:00
parent 52c6d68613
commit ea953c0514

View File

@ -1203,20 +1203,6 @@ class TiffImageFile(ImageFile.ImageFile):
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:
@ -1233,6 +1219,8 @@ class TiffImageFile(ImageFile.ImageFile):
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"""
@ -1542,8 +1530,6 @@ class TiffImageFile(ImageFile.ImageFile):
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)
#
# --------------------------------------------------------------------