I have a Gtk.Image object and I want to convert it's data to a base64 encoded string (for use with imgur). How would I achieve that?
Has to run it through a gdk.pixbuf, but this seems the easiest:
import cStringIO
import base64
pixBuf = gtkImage.get_pixbuf()
fH = cStringIO.StringIO()
pixBuf.save_to_callback(fH.write, "png")
encodedBuffer = base64.b64encode(fH.getvalue()) #base64 encoded png