2007.06.17 14:00 "[Tiff] Converting from Striped TIFF into Tiled TIFF", by Full Midnight

2007.08.27 11:07 "[Tiff] Fix proposal for TIFFAppendToStrip", by Even Rouault

Hello,

I repost here a message previously sent to GDAL trac that is probably more appropriate on this mailing list.

#1723: [PATCH] gdaladdo repeated on GTiff make image size increase

----------------+------------------------------------------------------

 Reporter:  rouault  |       Owner:  warmerdam
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:           
Component:  default  |     Version:  1.4.2    
 Severity:  normal   |    Keywords:  libtiff  

----------------+------------------------------------------------------

 Repeating the same gdaladdo command line (ex: 'gdaladdo -r average  world_dted0.tiff 2') make the image size increase each time of  128x128xsizeof(pixel type).

 I propose the following patch in libtiff to fix that (in  TIFFAppendToStrip, in tiff_write.c):

 {{{
 --- gdal-1.4.2.ori/frmts/gtiff/libtiff/tif_write.c      2007-07-28
 13:59:18.000000000 +0200
 +++ gdal-1.4.2/frmts/gtiff/libtiff/tif_write.c  2007-07-29
 18:42:10.000000000 +0200
 @@ -642,8 +642,8 @@
               * space, so such scheme is not too much effective.
               */
              if (td->td_stripbytecountsorted) {
 -                if (strip == td->td_nstrips - 1
 -                    || td->td_stripoffset[strip + 1] <
 +                if (strip != td->td_nstrips - 1
 +                    && td->td_stripoffset[strip + 1] <
                      td->td_stripoffset[strip] + cc) {
                      td->td_stripoffset[strip] =
                          TIFFSeekFile(tif, (toff_t)0,

 }}}

--

Ticket URL: <http://trac.osgeo.org/gdal/ticket/1723>

This change is still needed even with the recently commit of libtiff4 into GDAL svn.

Best regards