How to make an export file button?

I’m creating a game where the player can download an image after winning by pressing on a button. The image is an RawImage object. How do I do this? I couldn’t find anything in how to do this online… Can someone help me?

So you want to write the image to a file. Something along those lines for Texture2D to PNG:

Just need to convert the Texture contained in RawImage to Texture2D
https://stackoverflow.com/questions/58844351/converting-rendertexture-to-texture2d-in-unity-2019
In the posted solution, just use Texture instead of RenderTexture, since that’s the input CopyTexture expects anyways: Unity - Scripting API: Graphics.CopyTexture

There may be other and easier solutions for RawImage specifically but i never actually did this, so the above is pretty much just what google came up with.

Thank you!