AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1998.06.10 15:00 "TIFFGetField syntax and use", by Steve Garcia
1998.06.10 15:54 "RE: TIFFGetField syntax and use", by Frank Kim
1998.06.10 16:09 "Re: TIFFGetField syntax and use", by Steven Michael Garcia
1998.06.10 16:21 "Re: TIFFGetField syntax and use", by George Sazaklis
1998.06.10 17:04 "RE: TIFFGetField syntax and use", by Bill Davis

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. :-)