[Image-SIG] Poor Image Quality When Resizing a GIF
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Jan 11 03:00:07 CET 2008
Fredrik Lundh wrote:
> For the general case, I'd probably use JPEG for everything (if it's good
> enough for Google, etc). If you have lots of non-photographic images in
> your database, you can use PNG for things that have 256 colors or less:
> if im.getcolors(256):
> # limited number of colors
> im = im.convert("P", palette=Image.ADAPTIVE, dither=Image.NONE)
> im.save(out, "PNG")
> else:
> im.save(out, "JPEG")
PNG can cope with any number of colors (one of its advantages over GIF).
I suspect your advice is to determine the photo/non-photo property
by looking at the number of distinct colors. Unfortunately, the naive
reader might infer that he couldn't put 300-color images in PNG.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Image-SIG
mailing list