[Image-SIG] Dithering

Christian M. Jensen christianj at implicitnetworks.com
Mon Aug 29 07:01:14 CEST 2005

If I were to build a 32 gray level palette, still composed of 256 colors, just having duplicates, 000011111111222222222 etc. What would the code look like - general example is fine, I am pretty adept. I am just looking for the recommended method to use.
Please include how to build and apply the palette.


From: image-sig-bounces at python.org on behalf of Fredrik Lundh
Sent: Sun 8/28/2005 1:27 PM
To: image-sig at python.org
Subject: Re: [Image-SIG] Dithering

Christian M. Jensen wrote:

> I need to take a 256 level gray image down to 32 levels with nice
> dithering. What is the best process for doing that?

unless I'm missing something, I don't think you can do that in 1.1.5
(unless you want to do the dithering by hand).

the core library can do dithering both to fixed palettes and optimal
palettes, but PIL's convert method only exposes the "dither to web
palette" and "map to nearest N color" variants.

(if you want to do manual dithering, use quantize(32) on the source
image to get a reference image, take the difference between them,
and propagate the errors in some suitable way)


Image-SIG maillist  -  Image-SIG at python.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20050828/76bdd1a8/attachment.html

More information about the Image-SIG mailing list