[Image-SIG] Quantization of PNG images

Fredrik Lundh fredrik at pythonware.com
Mon May 18 13:14:59 CEST 2009

On Mon, May 18, 2009 at 1:10 PM, Fredrik Lundh <fredrik at pythonware.com> wrote:

> If you convert the image to mode "P" before you save it, you get a
> fixed 8-bit palette by default (based on "web safe colors").  To have
> PIL pick an "optimal" palette instead, use convert("P",
> palette=Image.ADAPTIVE).  See
>    http://effbot.org/tag/PIL.Image.Image.convert
> for more options.

And yes, make sure you pass optimize=True to the save method, to force
PIL to work a bit harder when compressing the image:



More information about the Image-SIG mailing list