mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Ensure TIFF has transposed on load before checking orientation
This commit is contained in:
parent
ea953c0514
commit
e195e60ce2
|
@ -8,7 +8,7 @@ from collections import namedtuple
|
|||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features
|
||||
from PIL import Image, ImageFilter, ImageOps, TiffImagePlugin, TiffTags, features
|
||||
from PIL.TiffImagePlugin import SAMPLEFORMAT, STRIPOFFSETS, SUBIFD
|
||||
|
||||
from .helper import (
|
||||
|
@ -1039,6 +1039,14 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
|
||||
assert_image_similar(base_im, im, 0.7)
|
||||
|
||||
def test_exif_transpose(self):
|
||||
with Image.open("Tests/images/g4_orientation_1.tif") as base_im:
|
||||
for i in range(2, 9):
|
||||
with Image.open("Tests/images/g4_orientation_" + str(i) + ".tif") as im:
|
||||
im = ImageOps.exif_transpose(im)
|
||||
|
||||
assert_image_similar(base_im, im, 0.7)
|
||||
|
||||
@pytest.mark.valgrind_known_error(reason="Backtrace in Python Core")
|
||||
def test_sampleformat_not_corrupted(self):
|
||||
# Assert that a TIFF image with SampleFormat=UINT tag is not corrupted
|
||||
|
|
|
@ -588,6 +588,7 @@ def exif_transpose(image, *, in_place=False):
|
|||
with the transposition applied. If there is no transposition, a copy of the
|
||||
image will be returned.
|
||||
"""
|
||||
image.load()
|
||||
image_exif = image.getexif()
|
||||
orientation = image_exif.get(ExifTags.Base.Orientation)
|
||||
method = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user