PyGTK: creating a pixbuf from image data
edwin at localhost.localdomain
Sun Mar 14 04:56:01 CET 2004
I'm writing a fractal-generating program in a mixture of C and
Python. Python handles all the GUI parts using PyGTK. After finishing
the calculations, I have a buffer containing the RGB data of the
image. I can display this fine on screen using draw_rgb_image. Now I
need to save the image data into a file. gtk.gdk.Pixbuf.save() would
be ideal, but I'm stumped trying to create a Pixbuf from my image
data. In C, gdk_pixbuf_new_from_data would be ideal, but I can't find
the PyGTK equivalent. There's new_from_xpm_data() and new_from_inline(),
but those seem to require translating the image into a text format,
which seems slow and kind of backwards.
I'd prefer to avoid introducing a dependency on PIL or Numeric.
More information about the Python-list