【问题标题】:Retrieving and editing photo 'tags' in Windows 10 UWP app在 Windows 10 UWP 应用中检索和编辑照片“标签”
【发布时间】:2015-12-09 00:45:36
【问题描述】:

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

var storageFile = await StorageFile.GetFileFromPathAsync(Path.ToString());
var imageProperties = await storageFile.Properties.GetImagePropertiesAsync();

这将返回以下内容:

  • 相机制造商
  • 相机型号
  • 拍摄日期
  • 高度/宽度
  • 关键字(System.__ComObject)
  • 纬度/经度
  • 方向
  • 评分
  • 人名 (System.__ComObject)

虽然这很有用,但无济于事。也许“关键字”是正确的,但是当我使用 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);

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

【问题讨论】:

    标签: windows-10


    【解决方案1】:

    关于元标记,似乎经常有同义词。根据我所见,标签和关键字似乎用于相同的事情。我最近一直在研究相同的主题,并且被困在关键字上。不过,我会分享一些我觉得有用的链接:

    https://msdn.microsoft.com/en-us/library/windows/apps/mt244350.aspx 具有用于读取和写入元数据的 UWP 代码。代码方面有点冗长。

    我发现下一个链接做得更简洁:

    Exif tags on universal Windows Platform C#

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

    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));
    

    它也适用于评论。

    这有链接到 MS 认为是与 am 图像相关的所有元数据。 https://msdn.microsoft.com/en-us/library/windows/apps/xaml/ee872003.aspx

    【讨论】:

      猜你喜欢
      • 2016-05-03
      • 2018-11-07
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 2021-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多