PyGTK: creating a pixbuf from image data

Edwin Young edwin at localhost.localdomain
Sat Mar 13 22:56:01 EST 2004


Hi,

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.

Any suggestions?

Thanks,
--
Edwin



More information about the Python-list mailing list