2008.11.21 21:56 "Re: [Tiff] Re: RGB to palette images", by Bob Friesenhahn
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, if desired, but maybe I am overlooking something.
The common problem is that the image contains more colors than the palette can contain. In the case where the input file is carefully crafted so that you always know that the number of colors will fit in the colormap, then the colormap can be constructed on the fly. I don't know if libtiff requires that the colormap be supplied up front, or if it can be attached at the end.
If you make sure to check for separate email from me, I will describe a method to speed quantization of your huge imges using existing GraphicsMagick
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/