mainpyFormex - Support: sr #108275, how to convert a canvas into a...


sr #108275: how to convert a canvas into a numpy array ?

Submitter:  francesco <francio>
Submitted:  Tue 26 Mar 2013 01:00:09 PM UTC
Category:  GUI Priority:  5 - Normal
Severity:  3 - Normal Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 26 Mar 2013 02:53:46 PM UTC, comment #1: 

You can grab the image as in gui/ and then convert it ot a numpy array:

  qim = pf.canvas.grabFrameBuffer()
  from plugins.imagearray import image2numpy
  ar = image2numpy(qim)

Or you can directly use an OpenGL call:

  from OpenGL import GL
  ar = Gl.glReadPixels(....)

Benedict Verhegghe <bverheg>
Group administrator
Tue 26 Mar 2013 01:00:09 PM UTC, original submission:  

I want to convert the canvas view directly into a numpy array or a Qimagewithout saving it first as an image. I am currently using
and I then load the image and convert it using image2numpy.
Is there a way to do it direclty?

francesco <francio>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by francio (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code