mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-21 20:54:47 +03:00
Handle default value for RowsPerStrip TIFF tag
This commit is contained in:
parent
759c518420
commit
b541aff64a
BIN
Tests/images/one_strip.tif
Normal file
BIN
Tests/images/one_strip.tif
Normal file
Binary file not shown.
|
@ -869,6 +869,11 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
im.load()
|
im.load()
|
||||||
assert im.size == (950, 975)
|
assert im.size == (950, 975)
|
||||||
|
|
||||||
|
def test_one_strip(self):
|
||||||
|
with Image.open("Tests/images/one_strip.tif") as im:
|
||||||
|
im.load()
|
||||||
|
assert im.size == (1728, 2344)
|
||||||
|
|
||||||
def test_orientation(self):
|
def test_orientation(self):
|
||||||
with Image.open("Tests/images/g4_orientation_1.tif") as base_im:
|
with Image.open("Tests/images/g4_orientation_1.tif") as base_im:
|
||||||
for i in range(2, 9):
|
for i in range(2, 9):
|
||||||
|
|
|
@ -328,7 +328,10 @@ _decodeStrip(Imaging im, ImagingCodecState state, TIFF *tiff) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);
|
ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip);
|
||||||
if (ret != 1) {
|
if (
|
||||||
|
ret != 1 ||
|
||||||
|
rows_per_strip == 4294967295 // 2 ** 32 - 1, the default
|
||||||
|
) {
|
||||||
rows_per_strip = state->ysize;
|
rows_per_strip = state->ysize;
|
||||||
}
|
}
|
||||||
TRACE(("RowsPerStrip: %u \n", rows_per_strip));
|
TRACE(("RowsPerStrip: %u \n", rows_per_strip));
|
||||||
|
@ -564,7 +567,7 @@ ImagingLibTiffDecode(
|
||||||
for (x = state->xoff; x < state->xsize; x += tile_width) {
|
for (x = state->xoff; x < state->xsize; x += tile_width) {
|
||||||
/* Sanity Check. Apparently in some cases, the TiffReadRGBA* functions
|
/* Sanity Check. Apparently in some cases, the TiffReadRGBA* functions
|
||||||
have a different view of the size of the tiff than we're getting from
|
have a different view of the size of the tiff than we're getting from
|
||||||
other functions. So, we need to check here.
|
other functions. So, we need to check here.
|
||||||
*/
|
*/
|
||||||
if (!TIFFCheckTile(tiff, x, y, 0, 0)) {
|
if (!TIFFCheckTile(tiff, x, y, 0, 0)) {
|
||||||
TRACE(("Check Tile Error, Tile at %dx%d\n", x, y));
|
TRACE(("Check Tile Error, Tile at %dx%d\n", x, y));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user