2002.08.22 22:17 "Problem Reading MultiPage TIFFs", by Steven Luke

2002.08.22 22:39 "RE: Problem Reading MultiPage TIFFs", by George Rypysc

For the page counting code, I'll refer you to the sample code at http://www.libtiff.org/libtiff.html#Dirs which is basically:

do {
    count++;
   } while (TIFFReadDirectory(tif));

Your code will give one less page than there really is or a count of 1 if you happen to forget the "!".

One last thing (related probably). I have also had trouble counting the pages in the TIFF. I was using this code:

do
{ TIFFReadDirectory (tif);
   count++;
} while (!TIFFLastDirectory (tif));

but it would only give me a count of 1 (saying my first directory is my last one). But I know that the image had 20 pages to it.

I hope that helps with your page reading problem.

George Rypysc
[Sorry about the legalese that I assume will be below, my company tacks it onto all out going e-mails]

This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all copies.