| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread1998.06.10 16:21 "Re: TIFFGetField syntax and use", by George SazaklisHi, Steve,
The correct way to use TIFFGetField is to pass
pointers to the actual variables as function parameters.
This is because C only supports call by value so when
you want to get a result back, you need to
use a pointer.
So the right way to do it is:
#include <tiffio.h>
main ()
{
uint16 photo, bitspersample; /* uint16 is unsigned int with 2 bytes */
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);
}
Also you should check the return value of TIFFGetField
for the case where the requested tag does not exist in the
TIFF file.
See the manual page for TIFFGetField
for a list of tags and the corresponding type.
Good luck!
George Sazaklis
|
|||||||