On Tue, Mar 24, 2009 at 10:46 AM, Jae-Joon Lee <lee.j.joon@gmail.com> wrote:
canvas = gcf().canvas
buf = canvas.tostring_rgb()

img = numpy.fromstring(buf, numpy.uint8)
im_size = canvas.get_width_height()
rgb = img.reshape(im_size[1], im_size[0], 3)
r, g, b = rgb[:,:,0], rgb[:,:,1], rgb[:,:,2]

Perhaps we should make this a friendly helper method of the agg backend canvas -- canvas.toarray() returns an rgba numpy array via canvas.buffer_rgba?