如何将 BitmapMetadata 键转换为相应的 XMP 名称?

发布于 2024-08-19 04:10:11 字数 1008 浏览 4 评论 0原文

我正在编写一个开源库来提取图像元数据并将其存储为 XML sidecar 中序列化的 XMP(理想情况下与 Adob​​e 应用程序序列化其元数据的方式相同)。

我的问题是 BitmapMetadata 似乎具有我需要的所有值,但键已损坏。其中许多只是整数,而不是相应的 XMP 命名空间 XML 样式名称。 Microsoft 声称他们正在使用 XMP 来存储 读取/写入媒体中许多不同格式的元数据,但我没有看到任何方法可以从这些元数据中重建一些标准 XMP 名称。

例如,Name="/{ushort=272}"、Format="ifd" 是我所拥有的,但我需要的是 其中 xmlns:tiff="http://ns.adobe.com/tiff/1.0/"。为此,我可以使用 ExifUtils 库 中的 ExifTags 来映射一些键,因为我知道它是什么。但我不确定其他许多人的情况。

我的问题:

  1. 任何熟悉 BitmapMetadata 的人都知道我是否陷入了死胡同吗?

  2. Microsoft 是否有编码的标准化映射?我尚未在 Adobe 官方 XMP 规范 中找到该规范。


更新:该库的开源代码现已在 Google Code 上以 XmpUtils 库的形式提供。它支持读取/写入 XMP 元数据作为标准的基于 RDF 的 XML。

I am writing an open-source library to extract image metadata and store as XMP serialized in an XML sidecar (ideally identically to how Adobe's apps serialize their metadata).

My problem is it appears that BitmapMetadata has all of the values that I need, but the keys are mangled. Many of them are just integers, rather than their corresponding XMP namespaced XML-style names. Microsoft claims they are using XMP to store reads/writes many different formats of metadata within media, but I do not see any way to reconstruct some of the standard XMP names from these.

For example, Name="/{ushort=272}", Format="ifd" is what I have but I need is <tiff:Model> where xmlns:tiff="http://ns.adobe.com/tiff/1.0/". For this, I can use the ExifTags from my ExifUtils library to map some of the keys because I know what it is. I'm not sure about many of the others though.

My question:

  1. Anyone familiar enough with BitmapMetadata to know if I'm headed down a dead-end?

  2. Is there a standardized mapping that Microsoft is encoding to? I haven't found one yet in Adobe's official XMP specs.


Update: the open source code for this library is now available at Google Code as XmpUtils library. It supports reading/writing XMP metadata as the standard RDF-based XML.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

演出会有结束 2024-08-26 04:10:11

我似乎偶然发现了 XMP 第 3 部分中的 第 18 页上的键映射规格。看起来 BitmapMetadata 只是公开了 JPEG 编码的 XMP 数据部分:

标记类型FFE0-FFEF是
通常用于应用程序数据,
名为 APPn。按照惯例,APPn
标记以字符串开头
识别用法,称为
命名空间或签名字符串。一个APP1
标记识别 Exif 和 TIFF
元数据; APP13 标记指定
Photoshop 图像资源 (PSIR)
包含 IPTC 元数据;另一个APP1
标记指定的位置
XMP数据包。

不确定最终列表来自哪里,因为这似乎不完整。


更新:

我刚刚偶然发现一组 MSDN 页面(“照片元数据策略”),其中链接到其支持的每个属性的相当全面的 Microsoft 元数据查询语言路径列表(左侧)。这是一种绝对可怕的格式,每页一个路径,但它似乎包含了我需要的大量数据。不幸的是,JPEG 和 TIFF 似乎有不同的路径...


更新:

此外,此页面很关键,因为它定义了这种类似于 XPath 的语法的疯狂之处:元数据查询语言概述

I seem to have stumbled upon the key mapping on page 18 in Part 3 of the XMP spec. It looks like BitmapMetadata is simply exposing the JPEG encoded XMP data sections:

The marker types FFE0-FFEF are
generally used for application data,
named APPn. By convention, an APPn
marker begins with a string
identifying the usage, called a
namespace or signature string. An APP1
marker identifies Exif and TIFF
metadata; an APP13 marker designates a
Photoshop Image Resource (PSIR) that
contains IPTC metadata; another APP1
marker designates the location of the
XMP packet.

Not sure where the definitive list comes from as this seems incomplete.


Update:

I just stumbled upon an MSDN set of pages ("Photo Metadata Policy") which links to a fairly comprehensive list of Microsoft Metadata Query Language paths (on left) for each property they support. It is a absolutely horrible format with one path per page but it seems to be a lot of the data I need. Unfortunately it looks like there are different paths for JPEG and TIFF...


Update:

Also this page is key, as it defines the craziness which is this XPath-like syntax: Metadata Query Language Overview

可遇━不可求 2024-08-26 04:10:11

事实证明,BitmapMetadata 使用的 Windows 成像组件 (WIC) 读取/写入许多不同的内容元数据块类型包括 TIFF、EXIF、IPTC、 XMP。这解释了为什么不幸的是它们的对象模型与 XMP 序列化模型不太对应;它是高度概括的。

我正在寻找的键映射取决于正在解码的部分,即使在 XMP 的情况下,它也不完全是一个干净的转换。其他答案中的 MSDN 链接提供了元数据查询语言的详细描述,该语言是 WIC 用于引用媒体中的元数据部分的类似 XPath 的语法。这对于将每个路径段解析为一个键非常有用,然后可以使用该键来确定相应的 XMP 命名空间和属性名称。

正如我在问题中提到的,我现在构建了这个库,它可以正确转换 TIFF、EXIF 和 XMP 块中很大一部分元数据属性。

请参阅 XmpUtils 库源代码,了解我最终如何以标准化方式提取这些数据的详细信息方式。

As it turns out, the Windows Imaging Component (WIC) used by BitmapMetadata reads/writes many different types of metadata blocks including TIFF, EXIF, IPTC, and XMP. This explains why unfortunately their object model does not correspond very closely with the XMP serialization model; it is highly generalized.

The key mapping which I was looking for depends on which section is being decoded, and even in the case of XMP, it isn't exactly a clean conversion. The MSDN links in the other answer give detailed descriptions of Metadata Query Language which is the XPath-like syntax that WIC uses to reference metadata sections within media. This is useful for parsing each path segment into a key which then may be used to determine the corresponding XMP namespace and property name.

As I mentioned in the question, I've now built this library which correctly converts a very high percentage of the metadata properties from the TIFF, EXIF, and XMP blocks.

See the XmpUtils library source code to see the details of how I ended up extracting this data in a standardized manner.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文