Making GIF image twice the size - in memory

Miki miki.tebeka at
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()
    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?

Miki <miki.tebeka at>

More information about the Python-list mailing list