Ionutz Borcoman wrote:
Hi,

What is the fastest way to display a PIL image in a DrawingArea ?

This will work with RGB and RGBA images:


import PIL.Image, Numeric, gtk

  i = PIL.Image.open('foo.png')
  w, h = i.size
  data = Numeric.fromstring(i.tostring(), 'b')
  data.shape = (w, h, -1)
  p = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, i.mode == 'RGBA', 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/

Reply via email to