def _image_to_pixbuf(self, im):
"""
Creates a pixbuf from an Image object. Probably unnecessary. In the future I could just invoke a save
and load then png instead.
"""
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
评论列表
文章目录