On 29 Dec 2011, at 12:31, auto11436...@hushmail.com wrote: > Hi, I wanted to get the actual bmp data without writting the content to disk. > > Example: > im = Image.new("RGB", (16, 16) ) > im.save('image.bmp') > > I want to avoid im.save, and just get the actual BMP file data for further > processing. > > Hope you can help me.
Hi, The im.save method can accept a file object instead of a filename, which means you can avoid writing to disk by passing it a StringIO object instead: import StringIO, Image im = Image.new("RGB", (16, 16) ) io = StringIO.StringIO() im.save(io, 'bmp') bmpdata = io.getvalue() - Matt _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig