Further to the initial query below, I have found that after signing on the signature pad, the control's ImageSource property is null. So I'm very confused about how to save this at the moment.
How do you save the signature as a jpg/png and so that it can be uploaded to cloud storage (e.g. Firebase Storage)
Nevermind - figured it out from your sample code. For those that were curious, here is what I did:
signaturePad.Save();
if(signaturePad.ImageSource != null)
{
StreamImageSource streamImageSource = (StreamImageSource)signaturePad.ImageSource;
System.Threading.CancellationToken cancellationToken = System.Threading.CancellationToken.None;
Task<Stream> image = streamImageSource.Stream(cancellationToken);
Stream stream = image.Result;
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "sig.png");
using (var fileStream = new FileStream(fileName,FileMode.Create, FileAccess.Write))
{
fileStream.Seek(0, SeekOrigin.End);
await fileStream.WriteAsync(bytes, 0, bytes.Length);
Debug.WriteLine($"Size = {fileStream.Length}");
}
Debug.WriteLine($"{fileName}");
}