« Return to Thread: Poor Image Quality When Resizing a GIF

Re: Poor Image Quality When Resizing a GIF

by Scott David Daniels :: Rate this Message:

Reply to Author | View in Thread

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@...

_______________________________________________
Image-SIG maillist  -  Image-SIG@...
http://mail.python.org/mailman/listinfo/image-sig

 « Return to Thread: Poor Image Quality When Resizing a GIF