We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to retrieve an image from the saved location in UWP?

Platform: UWP |
Control: SfImageEditor |
Published Date: December 26, 2018 |
Last Revised Date: June 25, 2019

Description:

In image editor, by default, the image is saved into the Pictures directory. You can retrieve and display the image stored in the location using the following steps:

 

Step 1: Create an image editor sample with all the necessary assemblies.

 

Please refer to this getting started documentation to create a simple SfImageEditor sample and configure it.

 

Step 2: The ImageSavedEventArgs is used to get the saved image location as its argument. Using this location, you can load an image to the image editor.

 

The following code sample demonstrates how to retrieve an image from the saved location.

C#

private void Editor_ImageSaved(object sender, ImageSavedEventArgs args)
{
    var location = args.Location; // gets the imaged saved location
    RetriveImageFromLocation(location, retrivedImage); // load the image from saved location
}
 
public async void RetriveImageFromLocation(string location, Image image)
{
    var file = await StorageFile.GetFileFromPathAsync(@"" + location);
    var stream = await file.OpenStreamForReadAsync();
    var bitMap = new BitmapImage();
    IRandomAccessStream randomAccessStream = stream.AsRandomAccessStream();
    await bitMap.SetSourceAsync(randomAccessStream);
    image.Source = bitMap;
}

 

You can find the sample for retrieving image from saved location in this link: Sample.

2X faster development

The ultimate UWP UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon