Use transposed size after opening for TIFF images by radarhere · Pull Request #8390 · python-pillow/Pillow
Alternative to #8387
At the moment, load() might change the size of a TIFF image, since TIFF images are automatically transposed when doing so.
load() is a method that many users are probably not even aware of, and so they might find
from PIL import Image im = Image.open("/Users/andrewmurray/pillow/Pillow/Tests/images/g4_orientation_5.tif") print(im.size) # (88, 590) print(im.copy().size) # (590, 88)
unexpected.
After this PR, the first im.size will also be (590, 88). This has means that changes from #6186 and #6190 can be removed.
#8387 solves this by making im.size sometimes different to im._size. I would like to avoid that, and have instead found a solution by adding TiffImageFile.load_prepare().
While we are here streamlining things so that an image does not change its size after loading, I've also updated ImageFile to remove an implication that loading might change an image's mode.