Windows 10 检索和编辑照片';标签';在Windows10UWP应用程序中

Windows 10 检索和编辑照片';标签';在Windows10UWP应用程序中,windows-10,Windows 10,我正在尝试访问(并最终编辑)存储在Windows文件中的标签,以驱动我的UWP Windows 10应用程序中的某些逻辑 var storageFile = await StorageFile.GetFileFromPathAsync(Path.ToString()); var imageProperties = await storageFile.Properties.GetImagePropertiesAsync(); 这将返回以下内容: 照相机制造商 摄像机模型 日期 高度/宽度 关键

我正在尝试访问(并最终编辑)存储在Windows文件中的标签,以驱动我的UWP Windows 10应用程序中的某些逻辑

var storageFile = await StorageFile.GetFileFromPathAsync(Path.ToString());
var imageProperties = await storageFile.Properties.GetImagePropertiesAsync();
这将返回以下内容:

  • 照相机制造商
  • 摄像机模型
  • 日期
  • 高度/宽度
  • 关键词(系统对象)
  • 横向/纵向
  • 定向
  • 评级
  • 人名(系统对象)
虽然这是有用的,但没有帮助。也许“关键字”是正确的,但是当我使用Windows资源管理器属性对话框查看图像时,我看到一个“标记”属性,它有一个值

var atts = new List<string>();
atts.Add(SystemProperties.Keywords);
atts.Add(SystemProperties.Rating);
atts.Add(SystemProperties.Comment);
var other = await storageFile.Properties.RetrievePropertiesAsync(atts);
var atts=新列表();
附件添加(系统属性关键字);
附件添加(系统属性评级);
附件添加(SystemProperties.Comment);
var other=wait storageFile.Properties.RetrievePropertiesAsync(atts);

这是我正在使用的代码。问题是这个方法总是返回null。

关于元标记,似乎经常有同义词。从我所看到的情况来看,标签和关键字似乎用于相同的事情。我最近一直在研究同一个主题,我被困在关键词上。不过,我将分享一些我觉得有用的链接:

具有用于读取和写入元数据的UWP代码。这在代码方面有点冗长

我发现下一个链接做的事情更简洁:

按照他们的模式,我可以像这样添加作者和标题:

var author = new BitmapTypedValue("Some Author", Windows.Foundation.PropertyType.String);
var title = new BitmapTypedValue("00103 My Company", Windows.Foundation.PropertyType.String);
list.Add(new KeyValuePair<string, BitmapTypedValue>("System.Author", author));
list.Add(new KeyValuePair<string, BitmapTypedValue>("System.Title", title));
<代码> var作者=新的BITMAPYPEDIVE(“一些作者”,Windows .Frime.PrimyType .String); var标题=新的BITMAPITPEDIVE(“00103我的公司”,Windows .FrimeType。 添加(新的KeyValuePair(“System.Author”,Author)); 添加(新的KeyValuePair(“System.Title”,Title)); 它也适用于评论

该链接指向MS认为与am图像相关的所有元数据。