[comp.graphics] what is a good way to chose a palette?

gwoho@nntp-server.caltech.edu (g liu) (12/05/90)

what is a good way to chose a palette for a picture? when picking the
palette, the number of bits per primary is reduced, and the number
of colors is llimited.
the algorithm must produce, when possable, colors which suround the
actual colors in the picture. i.e. if 5% of pixels are, say 0,
5% are 100, and 90% are 50, and the program is told to pick 2 colors,
it should pick 0 and 100, even though most pixels are 50.
this is because 50 can be made by dithering the 0 and 100.
if it chose, say 0 and 50, then the f-s error terms when mapping the
picture would diverge, and
the picture would look terible.
i want the algorithm that produces the best results; i dont care about cpu
time, as long as it doesn't take a few days.
gwoho liu.

gwoho@nntp-server.caltech.edu (g liu) (12/06/90)

i realize that there is an refrenence to this in the
frequently asked question. the algorithm there is crummy. pbmplus if
loaded with bugs, and its quantization algorithm doesn't work well if
the color resolution is lowered a lot (i.e. going from 8 bits per primary
to 2 bits per primary). also it doesn't do the first pixel of every other 
line, does something strange at the end of everyother line, and it
the arithmatic overflows in several places if i use 16bit ints, 32bit longs.
i want a diferent algorithm: one that handles lowering of color resolution
and limiting of the palette better.
gwoho liu.