[Image-SIG] Simple Question, avoid Image.save
matt at west.co.tt
Thu Jan 5 20:22:28 CET 2012
On 29 Dec 2011, at 12:31, auto11436877 at hushmail.com wrote:
> Hi, I wanted to get the actual bmp data without writting the content to disk.
> im = Image.new("RGB", (16, 16) )
> I want to avoid im.save, and just get the actual BMP file data for further processing.
> Hope you can help me.
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()
bmpdata = io.getvalue()
More information about the Image-SIG