2012.11.27 14:38 "Re: [Tiff] help writing thumbnails to TIFF file?", by Olivier Paquet
On Mon, Nov 26, 2012 at 9:10 PM, Paul Heckbert <firstname.lastname@example.org> wrote:
I side with those that are saying that TIFFCheckpointDirectory is useful and (at least sometimes) works properly. Without TIFFCheckpointDirectory, the directory would always appear at the end of a TIFF file, after the pixels, and reading partial TIFF files would be impossible. Some control of data order in the file IS useful, namely: does the directory appear before or after the pixels?
Ok, this isn't that relevant but I'll try to clear up some confusion.
Reading a partial TIFF does not require that the directory come before the pixels. It just happens to be a sensible place to put it which avoids gaps in the file and works as long as the directory does not change size. Note here that by "partial" TIFF I mean a TIFF which the software is not finished generating (what the function was originally written for), not a full TIFF file from which you only have the first N bytes (what you want).
My current hypothesis: TIFFCheckpointDirectory works fine if you're writing only one directory, but it's buggy when there are multiple directories.
Quite possible. It works by keeping the directory in memory for further checkpoints or the final write. Getting it to work with multiple directories requires rereading them (with TIFFSetDirectory) which is very different. It does look like it should work so it can't be that far from actually working. I will try to find some time to take a closer look.