resizing an image with alphachannel: dirty edges

Ivan Elchin <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
I have a problem, when i resizing an image with alphachannel.

Source image: http://dl.dropbox.com/u/932658/sega.png
Result image has dirty edges: http://dl.dropbox.com/u/932658/rez.png

Sample code code from Django Photologue):

====================================
import Image

im = Image.open("sega.png")

cur_width, cur_height = im.size
new_width, new_height = (200, 200)

if not new_width == 0 and not new_height == 0:
    ratio = min(float(new_width)/cur_width,
                float(new_height)/cur_height)
else:
    if new_width == 0:
        ratio = float(new_height)/cur_height
    else:
        ratio = float(new_width)/cur_width


new_dimensions = (int(round(cur_width*ratio)),
                  int(round(cur_height*ratio)))

new_im = im.resize(new_dimensions, Image.ANTIALIAS)

new_im.save('rez.png')
====================================
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.