Forum Libraries, Components, and Plugins

How do I save edited SKiaSharp image as an embedded image in a folders after encoding it?

psatpsat USMember

I would like to save png that I edited with SkiaSharp in a folder that I can access later to edit it more.

Basically this is what I'm trying to do:

1) grab two PNGs that are saved in my PCL project as embedded resource based on the user input
2) merging them together using SkiaSharp
3) save the resulted image
4) Upon the user making the next selection, I want to grab the saved PNG image and another PNG from the embedded resource and merge them again
5) repeat until user is done

I need help in saving the resulted PNG so that I can access it again for editing to do the above.
I have tried doing the following to save the image but I don't see any folder being created name "output" in the Android project after running it.

Is possible that the image is being saved somewhere and I just need to access it somehow? If yes, how do I access it?

SKData encoded_image = resulted_image.Encode(SKEncodedImageFormat.Png, 100);

IFolder rootFolder = FileSystem.Current.LocalStorage;
IFolder folder = await rootFolder.CreateFolderAsync("output", CreationCollisionOption.OpenIfExists);
IFile file = await folder.CreateFileAsync("result.png", CreationCollisionOption.ReplaceExisting);

using (Stream stream = await file.OpenAsync(FileAccess.ReadAndWrite))


  • mattleibowmattleibow ZAXamarin Team Xamurai

    The image is being saved on the device's local storage for the app. The MyDocuments special folder will be here:

    /data/data/@[email protected]/files

    You will find your image in there under your new "output" folder.

Sign In or Register to comment.