| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2008.11.21 22:12 "Re: RGB to palette images", by Toby ThainOn 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/ |
|||||||