[Tutor] PIL palettes?

Thomi Richards thomi@thomi.imail.net.nz
Wed Nov 6 19:40:01 2002


Hi there,

I'm trying to make a program which takes a 256 color picture, works out
what color palette it uses, and then converts other pictures to that
same color palette, hopefully with some error diffusion, so the results
do not look so bad. I can open the original image file, but how can i
extract the palette? and how to apply that same palette to another file,
with some error correction? I know i could do a pixel by pixel scan of
the original file, adding all the RGB triplets to a list of colors, and
then do a similar process to the files to be converted, but This is
going to be harder, longer, and probably more CPU intensive.

Any ideas/comments?

THanks.

-- 
Lord, what fools these mortals be!
 -- midsummer nights dream.
Thomi Richards,
thomi@imail.net.nz