andfanilo / streamlit-drawable-canvas

Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
https://drawable-canvas.streamlit.app/
MIT License
541 stars 83 forks source link

possible to save canvas data with background image #108

Closed matt-sd-watson closed 1 year ago

matt-sd-watson commented 1 year ago

Is it possible to save the canvas data along with the background image, either as a data frame or JSON? I have not yet been able to find an instance where the entirety of the canvas, including the background image, can be saved locally.

andfanilo commented 1 year ago

Hello,

Ah for now we're not passing the background image from the frontend back to Python because it made for even slower reruns on the Streamlit side :/ so I assumed that one could save the image on the server next to the state if needed, and use Pillow Image paste method to paste the drawing transparent PNG on the background image

MichaelSeitz98 commented 7 months ago

Hi @matt-sd-watson and @andfanilo

I am facing exactly the same problem just 2 years later. Did you @matt-sd-watson manage to solve the issue via the paste method? If so, how did you do it in detail? Would be much appreciated!

Thanks a lot! Michael

matt-sd-watson commented 7 months ago

I moved away from streamlit in favor of Flask and Dash for my application. The dcc.Graph components works much better for my requirements.