giuspen
November 25th, 2009, 09:59 PM
hi,
I need to serialize a binary content going through a function that writes a file name:
pixbuf.save("image_temp.png", "png")
fd = open("image_temp.png", "rb")
image_string = base64.b64encode(fd.read())
fd.close()
Does anybody know if it is possible somehow to skip the writing to disk?
The function pixbuf.save(...) described here (http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#method-gdkpixbuf--save) is the only one that allows me to obtain the binary data I need and takes a filename, but is there a kind of cached, fast way without going through the writing to disk or that's the only way?
thanks in advance.
I need to serialize a binary content going through a function that writes a file name:
pixbuf.save("image_temp.png", "png")
fd = open("image_temp.png", "rb")
image_string = base64.b64encode(fd.read())
fd.close()
Does anybody know if it is possible somehow to skip the writing to disk?
The function pixbuf.save(...) described here (http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#method-gdkpixbuf--save) is the only one that allows me to obtain the binary data I need and takes a filename, but is there a kind of cached, fast way without going through the writing to disk or that's the only way?
thanks in advance.