2002.07.29 18:58 "How to read number of pages for multipage TIFF", by Eugene Feiguelman

2002.08.16 07:39 "Re: How to read number of pages for multipage TIFF", by Andreas R. Kleinert

Could you please advise the method to retreive the number of pages from multipage TIFF frile.. I know this is a tag 297(129H) ...but how to read it?

Two possible answers, depending on what you meant:

  1. The same way as any other tag.
  2. The same way as in tif_dir.c - which has functions for this - or by scanning the file on your own, following the offset to the first directory as given in the header.

For 2. the answer is:

tif = TIFFOpen(name, "rb");
pages = TIFFNumberOfDirectories(tif);
TIFFSetDirectory(tif, n); // where n is 0..(pages-1)
TIFFReadDirectory(tif);
//...
TIFFGetField(...);

For 1. the point is:

TIFFGetField() or custom code.

Andreas_Kleinert@t-online.de  | http://www.ar-kleinert.de             |
Freelance Consultant & Writer | Software Engineering                  |
 *** PerSuaSiVe SoftWorX ***  | x86 Win/Linux, 68k/PPC Amiga and more |