2006.01.24 20:53 "[Tiff] Dead directories after TIFFRewriteDirectory()", by Roland Richter
in my current project, TIFF files are created in two steps:
Step 1: store a TIFF file containing two pages.
Step 2: add some meta data (i.e. custom tags) to the first
page, and remove the second one.
For step 2, I use TIFFRewriteDirectory() and TIFFUnlinkDirectory(), and it /seems/ to work... afterwards I have a TIFF file with only one image left, an with the additional tags.
BUT: the file size got *bigger*!
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
How can I prevent that?
Or, is there a way to "defrag" the TIFF file, i.e. get rid of those dead directories?