WinRT : 파일과 연결된 아이콘을 추출 하시겠습니까?
-
21-12-2019 - |
문제
WinRT Apps에서 특정 파일 (축소판이 아닌)과 관련된 이미지를 어떻게 얻을 수 있습니까?
해결책 2
어제도 발견 된이 솔루션도 있습니다.그러나 ThumbnailMode.Music
를 사용하면 앱의 backgroundColor와 함께 아이콘을 얻습니다.
마침내 나는 ThumbnailMode.SingleItem
와 함께 배경없이 더 나은 결과를 얻는 것을 발견했습니다.먼저 첫 번째 파일 확장명이있는 빈 파일을 만드고 Thumbnail을 가져 오려고합니다.
string filename = "_tmp_ext" + fileextension;
Windows.Storage.StorageFile file =
await ApplicationData.Current.TemporaryFolder.CreateFileAsync(
filename, CreationCollisionOption.OpenIfExists);
FileProperties.StorageItemThumbnail thumb =
await file.GetThumbnailAsync(FileProperties.ThumbnailMode.SingleItem,
16, FileProperties.ThumbnailOptions.ResizeThumbnail);
if (thumb != null) {
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(thumb.CloneStream());
/* ... */
}
.
더미 파일을 만들지 않고 다른 솔루션?
제휴하지 않습니다 StackOverflow