]> git.imager.perl.org - imager.git/commitdiff
Fixed tiff handling of images all contained in a single strip
authorArnar Mar Hrafnkelsson <addi@cpan.org>
Tue, 9 Jul 2002 14:52:30 +0000 (14:52 +0000)
committerArnar Mar Hrafnkelsson <addi@cpan.org>
Tue, 9 Jul 2002 14:52:30 +0000 (14:52 +0000)
(rowsperstrip = -1) and added a hack for images missing the rowsperstrip
tag.

Changes
tiff.c

diff --git a/Changes b/Changes
index 2da9fc991127fd74c5449ac8b4497b57f20d7a71..5bf323344090f2d010502422159a5246fd9cd675 100644 (file)
--- 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 317c599ea5d74d0ab08b04806b244a0cecafc295..27334378f1185f4d340a331852702f3d524979d2 100644 (file)
--- 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);