Save a Texture2D for android

I am accessing an image from android device gallery in unity made game and then assigning that image on my object as a texture2D. What I want now is to save that image(texture) so next time I start the game or the same scene I still have that image(texture) so I can use it on the same object. I can save the path to the image and load that image next time again from the gallery, but I don’t want to do that because it is kind a slow for me. Is there any solution to saving the image locally in the application folder or something similar.

Thanks

Mmm. i’ve never tried saving an image. But you could try this:

File.WriteAllBytes("Path/folder/MyImage.png",bytes);

You would somehow have to convert the image to a byte array.

Sorry if this isnt the answer you where looking for. But goodluck!

EDIT: you can use this to convert it to bytes:

byte[] _bytes =_texture.EncodeToPNG();

Source: (How to save a texture2d into a PNG? - Unity Answers)