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
November 2008

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

2008.11.21 21:27 "Re: RGB to palette images", by Richard Nolde
2008.11.21 21:45 "Re: RGB to palette images", by Kevin Myers
2008.11.21 21:56 "Re: RGB to palette images", by Bob Friesenhahn
2008.11.21 22:12 "Re: RGB to palette images", by Toby Thain
2008.11.21 21:54 "Re: RGB to palette images", by Frank Warmerdam
2008.11.21 22:24 "Re: RGB to palette images", by Bob Friesenhahn
2008.11.21 22:46 "Re: RGB to palette images", by Kevin Myers
2008.11.21 23:51 "Re: RGB to palette images", by Kevin Myers

2008.11.21 22:12 "Re: RGB to palette images", by Toby Thain

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/