I generate a set of Plotly plots (that all together make up a report), one after the other.
I would like to download them automatically on the PC or the user, without the user doing anything. Not sure this makes sense.
I can download images manually by clicking on the plotly camera icon. However here I hava set of grapsh generated automatically one after the other.
If possible I would prefer not to save anything on the server and to download directly.
Maybe the solution is to save all the images on the server, open a prompt for the user to download, and then delete the images on the server?
For security reasons, it is not a good practice to download the file automatically without user consent or interaction. The download_button is perfect for this. Let the user press that button.
It is not necessary to save the image file to a disk. Just use fig bytes data into the download_button.
Thanks @ferdy ,
I agree. What if I have more than one image (a set of png chart image I have generated on a batch) to download? Can I somehow find a way to download them as separate files, but with one single down_load button “press” by the user.
With more than one image, you can save the image bytes in a list, pickle it and send it to download_button.
That is what I wanted. Thanks a million!
How to get a plot’s bytes, instead of an image, to save it as image?
You should create a new topic. Or just search from internet.
img_bytes = fig.to_image(format="png")
Thank you @ferdy. I completely missed it as my knowledge of plotly is quite limited.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.