2001.06.12 18:22 "How i can findout total number of pages in TifFile.", by srinivas Rao

2001.06.13 01:50 "Re: How i can findout total number of pages in TifFile.", by Joris Van Damme

I am a C++ developer. I got a requirement, that without loading TIFF file into the memory, i want to know how many total number of pages existing inside the TIF file. Is there any way to do this?

I don't know whether the libtiff library has something easier and already written. Never used the library itself, just the utilities that come with it.

RTM, basically. Regarding speed issues, quoting Warmerdam in an old very related thread:

<quote>

You can go directly to a TIFF direct using TIFFSetSubDirectory() if you know the byte offset. However, if all you have is the page number you will need to use TIFFSetDirectory().

Luckily TIFFSetDirectory() appears to just read minimal information from each intermediate directory as it searches for the target directory. It particular it only parses all the tags in the directory once it finds the directory it wants. But it would generally do 5000 disk seeks and reads which could be quite expensive if the directories are distributed widely through the file.

<\unquote>

Joris