Making GIF image twice the size - in memory

Miki miki.tebeka at gmail.com
Thu Mar 22 22:04:28 CET 2007


Hello All,

I get an image from a web page (via urlopen), and like to make it
twice the size.
I'm trying (using PIL):
---- code ----
from ImageFile import Parser
def double(image_data):
    image_parser = Parser()
    image_parser.feed(image_data)
    im = image_parser.close()
    new_size = tuple(map(lambda x: 2 * x, im.size))
    new = im.resize(new_size)

    return new.tostring("gif", "P") # This is probably the problem,
have no idea

image_data = urlopen(url).read()
image_data = double(image_data)
---- code ----

However I don't get a valid GIF image.

Any ideas?

Thanks,
Miki <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com




More information about the Python-list mailing list