Return-Path: <tiff-bounces@lists.maptools.org>
Delivered-To: info@awaresystems.be
Received: (qmail 6589 invoked from network); 21 Nov 2008 22:14:11 -0000
Received: from janet.telenet-ops.be ([195.130.136.6])
          (envelope-sender <tiff-bounces@lists.maptools.org>)
          by angelia.telenet-ops.be (qmail-ldap-1.03) with SMTP
          for <info@awaresystems.be>; 21 Nov 2008 22:14:11 -0000
Received: from waldo.telenet-ops.be (waldo.telenet-ops.be [195.130.136.10])
	by janet.telenet-ops.be (8.13.1/8.13.1) with ESMTP id mALMEB8S031057
	for <info@awaresystems.be>; Fri, 21 Nov 2008 23:14:11 +0100
Received: from localhost (localhost.localdomain [127.0.0.1])
	by waldo.telenet-ops.be (Postfix) with SMTP id 98DC11C009
	for <info@awaresystems.be>; Fri, 21 Nov 2008 23:14:11 +0100 (CET)
Received: from penia.telenet-ops.be (penia.telenet-ops.be [195.130.132.39])
	by waldo.telenet-ops.be (Postfix) with ESMTP id 91BA51C007
	for <info@awaresystems.be>; Fri, 21 Nov 2008 23:14:11 +0100 (CET)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153])
	by penia.telenet-ops.be (Postfix) with ESMTP id 4B74D33E60C
	for <info@awaresystems.be>; Fri, 21 Nov 2008 23:14:11 +0100 (CET)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id mALMCTg2017093;
	Fri, 21 Nov 2008 17:12:48 -0500
Received: from toronto2.smartgames.ca (toronto2.smartgames.ca [204.15.192.18])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id mALMCSdM017090
	for <tiff@lists.maptools.org>; Fri, 21 Nov 2008 17:12:28 -0500
Received: from [10.143.176.101] (unknown [10.143.176.101])
	by toronto2.smartgames.ca (Postfix) with ESMTP id 2736A39A;
	Fri, 21 Nov 2008 17:12:35 -0500 (EST)
In-Reply-To: <67CBC9B3C1F54CF3AA7C9294E78581D5@KAM1720>
References: <200811211701.mALH13hu007438@duke.maptools.org><49270B32.9030801@qwest.net><0D422F7834824A26B434F1F21BF500B0@KAM1720>
	<492727A8.3080800@qwest.net>
	<67CBC9B3C1F54CF3AA7C9294E78581D5@KAM1720>
Mime-Version: 1.0 (Apple Message framework v753.1)
X-Priority: 3
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Message-Id: <5253C558-02A8-4863-AC85-83F37111A84B@telegraphics.com.au>
Content-Transfer-Encoding: 7bit
From: Toby Thain <toby@telegraphics.com.au>
Subject: Re: [Tiff] Re: RGB to palette images
Date: Fri, 21 Nov 2008 17:12:25 -0500
To: "Kevin Myers" <kmyers1@clearwire.net>
X-Mailer: Apple Mail (2.753.1)
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-SpamCatcher-Score: 50 [XX]


On 21-Nov-08, at 4:45 PM, Kevin Myers wrote:

> Richard Nolde wrote:
>
>> You cannot do it in one pass because the entries in a palettized  
>> image are indices into the palette, which you have not built  
>> unless you have seen all the entries.  In the special case that  
>> you know all the possible values ahead of time, you could do it in  
>> one pass. You could also do it in one pass if you knew in advance  
>> the mapping you wanted to use between the input values and the  
>> output values, eg for a USGS topo map, there are only a fixed  
>> number of possible colors and you can be sure that only a specific  
>> set of RGB values will appear in the data stream.  In that case,  
>> build you palette table at the top of the code, and convert RGB  
>> triplets to palette indices on the fly.
>
> But, while scanning an image, if I come across a new unique color  
> (a color that hasn't already been added to the palette), then I do  
> know the index into the palette, because I know that this is the  
> nth new color that I have added to the palette, right?  So, I still  
> think that this could be done in a single pass, building the  
> palette on the fly,


Seems quite logical to me, on your assumption that the image isn't  
going to overflow the palette, or if it does, that the first N  
colours discovered are the ones you want.

--Toby


> if desired, but maybe I am overlooking something.
>
> s/KAM
>
>
>
>
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
