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
[EMAIL PROTECTED]

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

Reply via email to