convert a PIL image to a GTK pixbuf
1 2 import gtk 3 import Image 4 5 def image2pixbuf(im): 6 file1 = StringIO.StringIO() 7 im.save(file1, "ppm") 8 contents = file1.getvalue() 9 file1.close() 10 loader = gtk.gdk.PixbufLoader("pnm") 11 loader.write(contents, len(contents)) 12 pixbuf = loader.get_pixbuf() 13 loader.close() 14 return pixbuf