JDoeDoeDoeJ
JDoeDoeDoeJ

Reputation: 47

How can I set an Image.Source from a StorageFile without losing quality?

Here is a way that I found and it works, but if my image becomes bigger than the values here it loses quality. My image also doesn't have a fixed size, so I would prefer to get it with the original quality.

Upvotes: 0

Views: 55

Answers (1)

JDoeDoeDoeJ
JDoeDoeDoeJ

Reputation: 47

using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
{
    BitmapImage bitmapImage = new BitmapImage();
    await bitmapImage.SetSourceAsync(fileStream);
    myImage.Source = bitmapImage;
}

Leaving out height and width will get me the full image!

Upvotes: 1

Related Questions