1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| import gtk import StringIO
f = StringIO.StringIO()
im.save(f, "ppm") contents = f.getvalue() f.close() loader = gtk.gdk.PixbufLoader("pnm") loader.write(contents, len(contents)) pixbuf = loader.get_pixbuf() loader.close() i = gtk.Image() i.set_from_pixbuf(pixbuf)
|