How to download image?

I demo this repo , and I wanna set a button to download a Processed image. .

I try cv2.imwrite(‘messigray.png’,img) but not work.

Hi @sevaroy, welcome to the Streamlit community!

This thread shows several examples of how to create a download link. In your code snippet, you are writing the image to a folder somewhere. So you either need to be able to pass that file location to a button for people to click, or you need to pass the actual bytes of the file to your download link.

Thank you! This works for me.

1 Like