AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2016

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date


The TIFF Mailing List Homepage
Archive maintained by AWare Systems

New Datamatrix section

Valid HTML 4.01!


2016.01.11 11:19 "Problem with TIFFCurrentDirectory", by John Stevenson-hoare
2016.01.11 14:18 "Re: Problem with TIFFCurrentDirectory", by Olivier Paquet

2016.01.11 14:18 "Re: Problem with TIFFCurrentDirectory", by Olivier Paquet

2016-01-11 6:19 GMT-05:00 John Stevenson-Hoare
> The man pages state that directories are indexed from 0, but when I create
> a new TIFF and invoke TIFFCurrentDirectory the return value is 65535. Is
> this a bug?

I would say yes but it has been around for so long that there might be
applications depending on it. The counter is set to -1 initially and
incremented when a directory is read. But it is incremented only after
directories are written so it's always late by 1 when writing a new
file. As far as I could see, the code dates back to the origin of the
CVS repo (1999). It might have been done that way on purpose... but I
can't see why and it's certainly confusing.

Directories are indeed counted from 0 so your best way out is probably
to just count them yourself when writing for now.

> My problem is that I need to cache the indexes of directories as I create
> them so that I can re-visit and update them. If I do this with a file
> containing 2 directories (both tiled images) the library reports:

That's an entirely different problem. libtiff wasn't really designed
for that kind of use but it might be possible to do what you want,
with some constraints. See the mailing list archive for February 2015.

Olivier Paquet
Tiff mailing list: