2004.10.17 23:34 "[Tiff] Help with tiff file", by C.F. Scheidecker Antunes

2004.10.19 03:48 "Re: [Tiff] Help with tiff file", by Andrey Kiselev

How can I be sure of the number of pages in a TIFF file?

tiffinfo prints report fo every page. The following printed for 3-paged TIFF:

TIFF Directory at offset 0x107a0
  Subfile Type: (0 = 0x0)
  Image Width: 664 Image Length: 813
  Resolution: 300, 300 pixels/inch
  Bits/Sample: 1
  Compression Scheme: None
  Photometric Interpretation: min-is-white
  Thresholding: halftone or dithered scan
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 98
  Planar Configuration: single image plane

TIFF Directory at offset 0x2778e
  Subfile Type: (0 = 0x0)
  Image Width: 277 Image Length: 339
  Resolution: 125, 125 pixels/inch
  Bits/Sample: 8
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Halftone Hints: light 203 dark 8
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 29
  Planar Configuration: single image plane

TIFF Directory at offset 0x3e794
  Subfile Type: (0 = 0x0)
  Image Width: 277 Image Length: 339
  Resolution: 125, 125 pixels/inch
  Bits/Sample: 8
  Compression Scheme: None
  Photometric Interpretation: min-is-white
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 29
  Planar Configuration: single image plane

Your tiffinfo report should look similar.

That is, how can I know for sure that it only has one page?

If tiffinfo reports single directory only (as in your case), you have no additional pages.

Would you know any place with sample code for libtiff? I would like to write a C app to extract extra pages in case there are more than one.

Take a look at the tiffsplit utility sources (in tools/ subdirectory).

Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517