AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.01.15 17:16 "How to determine number of colors in the colormap", by Bill Cassanova
2004.01.15 18:44 "Re: How to determine number of colors in the colormap", by Joris Van Damme
2004.01.15 18:59 "Re: How to determine number of colors in the colormap", by Bill Cassanova
2004.01.15 19:50 "Re: How to determine number of colors in the colormap", by Joris Van Damme
2004.01.15 20:14 "Re: How to determine number of colors in the colormap", by Bill Cassanova
2004.01.15 21:32 "Re: How to determine number of colors in the colormap", by Joris Van Damme

2004.01.15 17:16 "How to determine number of colors in the colormap", by Bill Cassanova

I have an 8-bit tiff image which I have been able to confirm has only 18 colors.
Is there some tag within the tiff itself
that says how many colors are actually present?  The value that is being
returned when I have ( 2**bits_per_sample )
or from another example I saw (( 1 << bitspersample ) -1 ) is 255 which is the
number of colors that I would expect
are possible although not necessarily present.

Also Using the code below which I think is correct I am not seeing any of my
known colors.....Instead I am seeing
values that seem to indicate I am deferencing the pointers incorrectly....Can
you point out my mistake?

uint16 *red;
uint16 *green;
uint16 *blue;

int num_entries = (1 << bitspersample) - 1;
cout << "num_entries: " << num_entries << endl;

           // get the photmetric interpretation
if ((result =
     TIFFGetField(image_in, TIFFTAG_COLORMAP, &red, &green, &blue)) != 1)
{
   return (false);
}
else
{
   for (int i = 0; i < num_entries; i++)
   {
      cout << red[i] << "\t" << green[i] << "\t" << blue[i] << endl;
   }

}


Thanks,
Bill