From 1b0554d1cd190162f1d3c0733110b8ab68c95d12 Mon Sep 17 00:00:00 2001 From: Arnar Mar Hrafnkelsson Date: Tue, 9 Jul 2002 14:52:30 +0000 Subject: [PATCH] Fixed tiff handling of images all contained in a single strip (rowsperstrip = -1) and added a hack for images missing the rowsperstrip tag. --- Changes | 5 ++++- tiff.c | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 2da9fc99..5bf32334 100644 --- a/Changes +++ b/Changes @@ -672,7 +672,10 @@ Revision history for Perl extension Imager. - mc_web_map was storing colors with an alpha of 0 - update the URLs for libpng and zlib - Fixed empty string handling for tt font driver. - + - Fixed tiff handling of images all contained in a + single strip (rowsperstrip = -1) and added a hack + for images missing the rowsperstrip tag. + ================================================================= For latest versions check the Imager-devel pages: diff --git a/tiff.c b/tiff.c index 317c599e..27334378 100644 --- a/tiff.c +++ b/tiff.c @@ -260,9 +260,13 @@ static i_img *read_one_tiff(TIFF *tif) { } } else { uint32 rowsperstrip, row; - TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); - mm_log((1, "i_readtiff_wiol: rowsperstrip=%d\n", rowsperstrip)); - + int rc = TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); + mm_log((1, "i_readtiff_wiol: rowsperstrip=%d rc = %d\n", rowsperstrip, rc)); + + if (rc != 1 || rowsperstrip==-1) { + rowsperstrip = height; + } + raster = (uint32*)_TIFFmalloc(width * rowsperstrip * sizeof (uint32)); if (!raster) { i_img_destroy(im); -- 2.39.5