/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import gtk import Image def image2pixbuf(im): file1 = StringIO.StringIO() im.save(file1, "ppm") contents = file1.getvalue() file1.close() loader = gtk.gdk.PixbufLoader("pnm") loader.write(contents, len(contents)) pixbuf = loader.get_pixbuf() loader.close() return pixbuf
Comments
