in xamarin.android I have an Android.Graphics.Bitmap and how to save it to the Pictures?
in xamarin.android I have an Android.Graphics.Bitmap and how to save it to the Pictures?
Hello,
Welcome to our Microsoft Q&A platform!
I have an Android.Graphics.Bitmap and how to save it to the Pictures
To save the bitmap to Android storage, you could create a FileStream object with the path and then call the Bitmap.Compress method to generate the picture.
Check the code:
var folder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
var filePath = System.IO.Path.Combine(folder, "test.png");
var stream = new FileStream(filePath, FileMode.Create);
//get the bitmap
bitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);
stream.Close();
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Do you mean storing the bitmap as multi pictures? It's supported to do that.
But As I know If I compress for muti-times there will be an error.
8 people are following this question.