[Image-SIG] Poor Image Quality When Resizing a GIF
douglas bagnall
douglas at paradise.net.nz
Wed Jan 9 23:57:12 CET 2008
hi Andy
> Here's the resized gif with the original code I pasted. You'll see a
> bunch of 'dots' throughout the image:
> http://www.andymccurdy.com/resized_1.gif
PIL uses the so-called "web palette" by default. Your image uses
#fdfdfd for white, but the web palette uses #ffffff. So it dithers to
approximate #fdfdfd. You probably really want the background to be
pure #ffffff white, because printers etc will also dither, but the
more immediate problem is the web palette. Try this:
pil_image = pil_image.convert("P", palette=Image.ADAPTIVE)
or
pil_image = pil_image.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
These options are not well documented, but you can find them in the
PIL/Image.py source.
douglas
More information about the Image-SIG
mailing list