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,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to