Opened 16 years ago

Last modified 16 years ago

#63 closed defect (fixed)

Writing georeferenced tiff files sometimes broken

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

An action like:

  gdal_translate -srcwin 0 0 100 100 utm.tif out.tif

will result in a out.tif having the first line (or fiew lines) of the
output file corrupted.  It appears this is because the GeoTIFF information
is not written at the end of the file, but instead written right after 
the directory which is before the regular data.  But with the geotiff info 
added (while closing the file) the total directory size is larger than when
it was initially crystalized before the image writing began causing it to
overrun the image data.

Change History (1)

comment:1 Changed 16 years ago by warmerdam

I have added a TIFFRewriteDirectory() entry point in libtiff, and utilized
that within GDALDataset::~GDALDataset() when the geotiff information is
updated (if it is available in the build configuration).  This appears to have
cleaned up the problem. 

The TIFfRewriteDirectory() function has been commited back to the libtiff
source, and should appear in the public libtiff 3.5.7 release.  If that isn't
available, please configure GDAL with the internal libtiff and libgeotiff 
code. 

Note: See TracTickets for help on using tickets.