2007.08.07 14:41 "[Tiff] Indexed Images", by Christian Henning

2007.08.07 15:27 "[Tiff] Indexed Images - part 2", by Christian Henning

Hi there, it's not my day it seems. This time I'm trying to read an indexed image. But reading the color map is crashing the application. I'm using the jello.tif test image. The photometric value is set to 3 which indicates an indexed image.

Here is what I'm doing:

int main()
{
   TIFF* file = TIFFOpen( "jello.tif", "r" );

   tsize_t width;
   tsize_t height;
   short bits_per_sample;
   short samples_per_pixel;
   short photo_metric;

   TIFFGetField( file, TIFFTAG_BITSPERSAMPLE, &bits_per_sample );
   TIFFGetField( file, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel );
   TIFFGetField( file, TIFFTAG_IMAGEWIDTH, &width );
   TIFFGetField( file, TIFFTAG_IMAGELENGTH, &height );
   TIFFGetField( file, TIFFTAG_PHOTOMETRIC, &photo_metric );

   toff_t* color_map = NULL;
   TIFFGetFieldDefaulted( file, TIFFTAG_COLORMAP, &color_map );

   return 0;
}

I'm sure it's something very simple.

Thanks in advance,

Christian