Open radarhere opened 6 days ago
Resolves #8554
When a TIFF image is YCbCr, Pillow calls libtiff's TIFFRGBAImageBegin https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L729 https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L739-L740 https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L295
TIFFRGBAImageBegin
Looking at that libtiff code, it then calls either PickContigCase or PickSeparateCase. Those set img->get to gtTileContig, gtStripContig, gtTileSeparate or gtStripSeparate. All four of those functions apply orientation to the image based on img->orientation.
PickContigCase
PickSeparateCase
img->get
gtTileContig
gtStripContig
gtTileSeparate
gtStripSeparate
img->orientation
Pillow expects to manage image orientation itself. This PR sets img.orientation to prevent libtiff from doing so.
img.orientation
Resolves #8554
When a TIFF image is YCbCr, Pillow calls libtiff's
TIFFRGBAImageBegin
https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L729 https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L739-L740 https://github.com/python-pillow/Pillow/blob/5bff2f3b2894ec6923c590d0c37b18177d0634bd/src/libImaging/TiffDecode.c#L295Looking at that libtiff code, it then calls either
PickContigCase
orPickSeparateCase
. Those setimg->get
togtTileContig
,gtStripContig
,gtTileSeparate
orgtStripSeparate
. All four of those functions apply orientation to the image based onimg->orientation
.Pillow expects to manage image orientation itself. This PR sets
img.orientation
to prevent libtiff from doing so.