Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread Fredrik Lundh
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

Re: [Image-SIG] rounded corners

2008-01-09 Thread Stani
I forgot to take of the _t function, so the first lines should be: CROSS = 'Cross' ROUNDED = 'Rounded' SQUARE = 'Square' Stani schreef: In PIL this is easy. The following code preferably uses cache (just a simple python dictionary) to avoid

Re: [Image-SIG] rounded corners

2008-01-09 Thread Stani
In PIL this is easy. The following code preferably uses cache (just a simple python dictionary) to avoid the overhead of generating the same transparency masks. So typical use would be: cache = {} for image in images: thumbnail = image_round(image.thumbnail(size, filter), cache, radius)

[Image-SIG] Poor Image Quality When Resizing

2008-01-09 Thread Andy McCurdy
Hi all, 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. Resizing the same image with ImageMagick's convert utility produced a far better quality image. I'd rather

Re: [Image-SIG] Zooming any image

2008-01-09 Thread Fredrik Lundh
Varsha purohit wrote: In my program i have a gui where i am showing an image on the panel. I want to implement zoom in and zoom out functions using wxpython and PIL. I am tryin to find in PIL if there is any functionality like that. the transpose(EXTENT) method is often used for

Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread Andy McCurdy
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

Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread douglas bagnall
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

Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread Andy McCurdy
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

Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread douglas bagnall
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

Re: [Image-SIG] Poor Image Quality When Resizing a GIF

2008-01-09 Thread Andy McCurdy
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