I am using SignaturePad Nuget for PCL.
How do i convert this System.IO.Stream into an Image?
Any idea would be appreciated.. Thank you.
I am using SignaturePad Nuget for PCL.
How do i convert this System.IO.Stream into an Image?
Any idea would be appreciated.. Thank you.
Here's what I found after 2 weeks of research about this.
This is the code in c# to save an signature to a png file on android phone.
async void Enregistrer(object sender, EventArgs e)
{
// This is the code to get the image (as a stream)
var img = padView.GetImage(Acr.XamForms.SignaturePad.ImageFormatType.Png); // This returns the Bitmap from SignaturePad.
img.Seek(0,0); // This is to have the current position in the stream
// create a new file stream for writing
FileStream fs = new FileStream(Android.OS.Environment.ExternalStorageDirectory + "/imagefilename.png", FileMode.Create,FileAccess.Write); // create a new file stream for writing
await img.CopyToAsync(fs); // have the image stream to disk
fs.Close(); // close the filestream
img.Dispose(); // clear the ressourse used by the stream
}
have fun !