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
Andy McCurdy wrote:
Just started using PIL. I'm attempting to resize a .gif image to a
smaller size, keeping the height/width proportional. The resize
works, but the resulting image is very grainy.
try converting the image to RGB first, and use resize(ANTIALIAS) on
the RGB image before
Fredrik, thanks for the reply. I am in fact converting to RGB
first... at least I think so. Here's the code I'm using that produces
bad results:
from PIL import Image
# io is a file handle
pil_image = Image.open(io)
# convert to rgb
pil_image = pil_image.convert('RGB')
# new_width/new_height
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 #ff. So it dithers to
Hey Douglas,
I interpreted your response as a setting to change to make this
specific image resize better. I'm using PIL to resize images that
users upload to my website. Since I don't have control over the
media, I need generic settings that will be good for all users. What
settings would you
Andy McCurdy [EMAIL PROTECTED] wrote:
I interpreted your response as a setting to change to make this
specific image resize better. I'm using PIL to resize images that
users upload to my website. Since I don't have control over the
media, I need generic settings that will be good for all
Thanks Douglas. Just tested it out, and the quality has improved
dramatically on all GIF images I threw at it.
On Jan 9, 2008 3:34 PM, douglas bagnall [EMAIL PROTECTED] wrote:
Andy McCurdy [EMAIL PROTECTED] wrote:
I interpreted your response as a setting to change to make this
specific