c# - 如何从我的文件夹中获取缩略图?
问题描述
我想知道如何使用 C# 在 UWP 中获取缩略图
我想在我的文件夹中获取图像文件(gif、jpg 等)的所有缩略图
我阅读了很多关于获取缩略图的代码,并参考了这个和其他示例
但我无法完全理解 Xaml 的过程
你能告诉我如何从我的图书馆文件夹中获取缩略图吗?
解决方案
一旦您通过用户选择访问文件夹后,您FolderPicker
可以从系统中检索缩略图。你可以使用GetScaledImageAsThumbnailAsync()
它。例如:
private async Task<BitmapImage> GetThumbnail(StorageFile file)
{
if (file != null)
{
StorageItemThumbnail thumb = await file.GetScaledImageAsThumbnailAsync(ThumbnailMode.VideosView);
if (thumb != null)
{
BitmapImage img = new BitmapImage();
await img.SetSourceAsync(thumb);
return img;
}
}
return null;
}
推荐阅读
- android - 如何禁用 Kotlin 中的按钮?
- javascript - 按复选框组的多过滤元素
- android-studio - 如何跳转到Android Studio中lamba参数的源类?
- light-4j - 如何使用ligth4j操作mysql
- undertow - 如何获取 HttpServletRequest 或 HttpServletResponse ?
- ios - 如何在 Coredata 中管理并发?
- wso2 - 使用阻塞呼叫时聚合调解器不起作用
- python - 如何将参数发送到模拟函数?
- java - 从另一个调用 REST 端点
- linux - 在 Linux 下,SD 卡上的控制器可以重新排序写入吗?