2006.01.24 20:53 "[Tiff] Dead directories after TIFFRewriteDirectory()", by Roland Richter

2006.01.26 14:00 "Re: [Tiff] Dead directories after TIFFRewriteDirectory()", by Frank Warmerdam

On 1/24/06, Roland Richter <roland@flll.jku.at> wrote:

As far as I can tell from the directory offsets, it simply appended the new directoy 1 to the end of the file, and didn't remove directory 2.

So, obviously I've got two "dead" directories within that TIFF:

(old1) (old2) new1

Roland,

You are correct. Rewriting directories will generally result in dead ones getting left behind.

How can I prevent that?

Or, is there a way to "defrag" the TIFF file, i.e. get rid of those dead directories?

Copying the file with tiffcp will get rid of the dead directories, but it will also lose custom tags. You might want to build your own "copier" to defrag the files, if this is important enough to you. It might also be that there are copying programs that will carry along all existing tags (custom or otherwise) but libtiff is not very handy for this.

Best regards,
--

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent