AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, 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

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

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
<John.Stevenson-Hoare@ffei.co.uk>:
> 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: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/