简体   繁体   中英

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM