PyGTK: creating a pixbuf from image data
Edwin Young
edwin at localhost.localdomain
Thu Mar 18 10:25:27 EST 2004
John Hunter <jdhunter at ace.bsd.uchicago.edu> 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.save()
>
> 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.
Thanks,
--
Edwin
More information about the Python-list
mailing list