[Image-SIG] Image.tostring method

Jeff Simpson jeffrey.simpson@supplysolution.com
Fri, 13 Oct 2000 12:29:40 -0700


I'm trying to use the Image.tostring method to spit out data for a gif
image I have generated in a script.  I can successfully use
Image.save('blah.gif') to create a gif, but would like to be able to
store this data in memory and eventually shove it into a web page - sans
file.  Does anyone have an example call (with args for the encoder).
Here is what I've been using for Image.tostring:

....some steps to create the image with RGBA mode skipped
# Now I wanna get the str data
>>> data = im.tostring('gif', 'RGBA')
>>> im.save(blah_a.gif')
>>> fd = open('blah_b.gif', 'w')
>>> fd.write(data)
>>> fd.close()

blah_a, generated from Image.save is happy and I can viedw it with xv.
blah_b, generated with Image.tostring is bogus.  I'm a little confused
as to what needs to be passed to the encoder to make it work correctly.
Help?

Thanks