I am trying to figure out a simple way of converting a Numeric array to a gtk.gdk.Pixbuf without depending on PIL.
I am having a hard time finding documentation on how to make an RGB XPM file or even if it is possible.
gdk_pixbuf_new_from_data seems like is what I want, but it does not appear to be wrapped in pygtk 1.99.14.
Any suggestions?
Tony
I'm not sure about 1.99.14, but 1.99.16 can be compiled with Numeric support. If it is you can create a Pixbuf by modifying the array returned be accessing the 'pixel_array' attribute of an existing pixbuf.
Assuming that you have a (n,m,3) or (n,m,4) shape 'b' type array of RGB or RGBA values called 'data', you would do this:
w,h = data.shape[:2] hasalpha = shape.shape[3] == 4 p = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, hasalpha, 8, w, h) p.pixel_array[:] = data
-- Tim Evans Applied Research Associates NZ http://www.aranz.com/
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
