Return-Path: <tiff-admin@remotesensing.org>
Received: from jay.skynet.be (jay.skynet.be [195.238.3.234])
        by twentyeight.skynet.be (8.12.9/8.12.9/Skynet-MAILSTORE-2.14) with ESMTP id i0FI2CsE007510
        for <joris.at.lebbeke@skynet.be>; Thu, 15 Jan 2004 19:02:12 +0100
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com ([208.24.120.42])
        by jay.skynet.be (8.12.9/8.12.9/Skynet-IN-2.32) with ESMTP id i0FHU2Jh030891
        for <joris.at.lebbeke@skynet.be>; Thu, 15 Jan 2004 18:30:02 +0100
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com (localhost.localdomain [127.0.0.1])
	by yoda.imagelinks.com (8.11.6/8.11.2) with ESMTP id i0FHI7l05764;
	Thu, 15 Jan 2004 12:18:07 -0500
Received: from dmzmm03.dmz.weather.com (mv.twc.weather.com [216.133.140.39])
	by yoda.imagelinks.com (8.11.6/8.11.2) with ESMTP id i0FHHAl05721
	for <tiff@remotesensing.org>; Thu, 15 Jan 2004 12:17:10 -0500
Received: from domino.twc.weather.com (Not Verified[216.133.141.140]) by dmzmm03.dmz.weather.com with NetIQ MailMarshal (v5.5.5.6)
	id <BD0038a8be>; Thu, 15 Jan 2004 12:17:40 -0500
To: tiff@remotesensing.org
X-Mailer: Lotus Notes Release 5.0.11   July 24, 2002
Message-ID: <OFCE19FF0C.048BE493-ON85256E1C.005EB79F-85256E1C.005F03E6@twc.weather.com>
From: "Bill Cassanova" <BCassanova@weather.com>
X-MIMETrack: Serialize by Router on domino/TWC(Release 5.0.10 |March 22, 2002) at 01/15/2004
 12:16:23 PM
MIME-Version: 1.0
Content-type: text/plain; charset=us-ascii
Subject: [Tiff] How to determine number of colors in the colormap
Sender: tiff-admin@remotesensing.org
Errors-To: tiff-admin@remotesensing.org
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.0.11
Precedence: bulk
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Post: <mailto:tiff@remotesensing.org>
List-Subscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
List-Id: TIFF and libtiff discussion <tiff.remotesensing.org>
List-Unsubscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://remotesensing.org/pipermail/tiff/>
Date: Thu, 15 Jan 2004 12:16:23 -0500
X-UIDL: b80abe86d31712ee46729e3ea3eaaf51



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



_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://remotesensing.org/mailman/listinfo/tiff
