PyGTK: creating a pixbuf from image data

Edwin Young edwin at localhost.localdomain
Thu Mar 18 16:25:27 CET 2004

John Hunter <jdhunter at> writes:
> >>>>> "Edwin" == Edwin Young <edwin at localhost.localdomain> writes:
>     Edwin> Hi,
>     Edwin> I'm writing a fractal-generating program in a mixture of C
>     Edwin> and Python. Python handles all the GUI parts using
>     Edwin> PyGTK. After finishing the calculations, I have a buffer
>     Edwin> containing the RGB data of the image. I can display this
>     Edwin> fine on screen using draw_rgb_image. Now I need to save the
>     Edwin> image data into a file. 
> gtk.gdk.Pixbuf does have a save method

Right, the problem is getting the data *into* the pixbuf in the first
place. Basically I have the image in a long string in memory and need
to get that into the Pixbuf somehow. The pixel_array is read-only, so
I can't use that.

I don't think Gustav's idea will work because the loader expects the
*encoded* pixels (+ header, etc) from a jpeg file, and if I already
had a jpeg encoder I could just save the file myself.

More information about the Python-list mailing list