On Wed, 2003-07-30 at 11:45, Christian Reis wrote: > On Tue, Jul 29, 2003 at 09:27:45AM +1200, Tim Evans wrote: > > Anthony Joseph Seward wrote: > > > > >I am trying to figure out a simple way of converting a Numeric array to > > >a gtk.gdk.Pixbuf without depending on PIL. > > [snip] > > > 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 > > Added as FAQ 8.3, thanks: > > http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq08.003.htp > > Take care,
The PyGTK reference at http://www.moeraki.com/pygtkreference/pygtk2reference/class-gdkpixbuf.html says Attributes "pixel_array" Read A numeric ... So according to the reference pixel_array is a read only attribute. Is the reference in error? Tony -- Anthony Joseph Seward <[EMAIL PROTECTED]> _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
