Hi @杨岑 ,
Welcome to Microsoft Q&A!
There is StorageFile.GetThumbnailAsync in UWP that can get an adjusted thumbnail image for the file. It is recommended to refer to the File thumbnails sample.
var picker = new Windows.Storage.Pickers.FileOpenPicker();
picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
picker.FileTypeFilter.Add(".exe");
//picker.FileTypeFilter.Add(".jpeg");
//picker.FileTypeFilter.Add(".png");
Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
// Get the thumbnail
StorageItemThumbnail thumbnail = await file.GetThumbnailAsync(ThumbnailMode.SingleItem);
//Set Image source
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(thumbnail);
imageTest.Source = bitmapImage;
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.