1
2
3
4
5
6
7
8
9
10
11
12
| byte[] ConvertSKBitmapToByteArray(SKBitmap bitmap, SKEncodedImageFormat format)
{
using (var image = SKImage.FromBitmap(bitmap))
using (var data = image.Encode(format, 100))
{
return data.ToArray();
}
}
var arr = bmp.Bytes;// ConvertSKBitmapToByteArray(bmp, SKEncodedImageFormat.Png);
await JSRuntime.InvokeVoidAsync("downloadImage", Convert.ToBase64String(arr), "image.png");
await JSRuntime.InvokeVoidAsync("downloadImageUrl", $"https://picsum.photos/200/300", "image.png");
await JSRuntime.InvokeVoidAsync("generateImage", IDOfImageToDownload); // element as canvass as image
|