1998.06.10 15:54 "RE: TIFFGetField syntax and use", by Frank Kim
try this:
#include <tiffio.h>
int photo, bitspersample;
main ()
{
TIFF *tif = TIFFOpen("myfile.tif", "r");
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photo);
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
printf("Photo = %d, Bits/Sample = %d", photo, bitspersample);
TIFFClose(tif);
}
by the way, i suggest moving to C++ instead of C. much better language.
then for printing you can do this:
cout << "Photo = " << photo << ", Bits/Sample = " << bitspersample << endl;
see how you don't have to worry about the type of the data you are printing. :-)