private async void SaveCanvas(SKSurface surface) { try { var data = surface.Snapshot().Encode(SKEncodedImageFormat.Png, 100); var skBitmap = SKBitmap.Decode(data.AsStream(true)); DateTime dt = DateTime.Now; string filename = String.Format("Collage-{0:D4}{1:D2}{2:D2}-{3:D2}{4:D2}.png", dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute); var scaled = skBitmap.Resize(new SKImageInfo(_width * 2, _height * 2), SKBitmapResizeMethod.Lanczos3); SKImage image = SKImage.FromBitmap(scaled); SKData png = image.Encode(SKEncodedImageFormat.Png, 100); IImageStorageService dependencyService = DependencyService.Get <IImageStorageService>(); //Save the bitmap and get a boolean indicating success. bool result = await dependencyService.SaveBitmap(png.ToArray(), filename); if (result) { _files = null; canvasViews.InvalidateSurface(); } else { await DisplayAlert("bad", "error occured", "cancel"); } ButtonSave.IsEnabled = true; _isSaving = false; } catch (Exception ex) { await DisplayAlert("Error", ex.Message, "Ok"); _isSaving = false; } }