jupyter-widgets-contrib / ipycanvas

Interactive Canvas in Jupyter
https://ipycanvas.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
685 stars 62 forks source link

Take a screenshot of a drawing/canvas and save it? #319

Closed haesleinhuepf closed 1 year ago

haesleinhuepf commented 1 year ago

Hi @martinRenou ,

ipycanvas is amazing! Just one quick question: Is it possible to retrieve a canvas in a numpy array or pillow image so that we can save a drawing?

Big thanks!

Best, Robert

martinRenou commented 1 year ago

Thanks for the kind words!

You can retrieve the image following https://ipycanvas.readthedocs.io/en/latest/retrieve_images.html#get-image-data-as-a-numpy-array

Though it's not an ideal API. I've been working on a more robust way to retrieve the image data in https://github.com/martinRenou/ipycanvas/pull/301 but it's not finished yet.

haesleinhuepf commented 1 year ago

Fantastic! Also for the instant reply!🤩