【问题标题】:Unable to retrieve full text of title from JPEG metadata无法从 JPEG 元数据中检索完整的标题文本
【发布时间】:2016-10-09 19:45:12
【问题描述】:

这与 Extract IPTC-Keywords Longer than 64 Chars in Java 密切相关。请在那里查看我的 cmets。

问题是在 Adob​​e Bridge 中添加到 JPEG 文件的标题在描述选项卡中作为“文档标题”(在 Windows 文件属性对话框的“详细信息”选项卡中也显示为“标题”)在两个位置结束JPEG 文件,可以在文件的十六进制显示中看到。一个有完整的标题,一个只有 64 个字符。

我可以通过检索所有元数据目录中的所有标签描述来获得截断的(标签名称“对象名称”),但我无法获得完整的标题。

这是一个示例文件,其嵌入标题为“清晨在怀奥海海滩俱乐部和波伊普海滩公园之间的吐痰”:

【问题讨论】:

  • 提到的相关问题是stackoverflow.com/q/38399216/24874
  • 您的非答案中的十六进制转储是否也与此问题相关?然后请在此处添加它们,因此问题不言自明。如果您无法嵌入图像,请不要担心 - 可以的人肯定会为您这样做。

标签: java jpeg metadata-extractor


【解决方案1】:

我很乐意为您看看这个。但是 imgur 已从该文件中删除了元数据。

你能在 GitHub 项目上打开一个问题吗?那里的任何附加图像都不会删除元数据:

https://github.com/drewnoakes/metadata-extractor/issues/new

还请说明您是否授予在项目的回归测试数据集中使用该图像的权限。


我可以从您的另一篇文章中看到,您引用的较长形式是:

该字符串在 XMP 数据中(由围绕它的 RDF XML 证明)。您可以使用类似的代码访问它:

// Extract metadata from the image
Metadata metadata = ImageMetadataReader.readMetadata(image);

// Iterate through any XMP directories we may have received
for (XmpDirectory xmpDirectory : metadata.getDirectoriesOfType(XmpDirectory.class)) {

    // Usually with metadata-extractor, you iterate a directory's tags. However XMP has
    // a complex structure with many potentially unknown properties. This doesn't map
    // well to metadata-extractor's directory-and-tag model.
    //
    // If you need to use XMP data, access the XMPMeta object directly.
    XMPMeta xmpMeta = xmpDirectory.getXMPMeta();

    // Iterate XMP properties
    XMPIterator itr = xmpMeta.iterator();
    while (itr.hasNext()) {
        XMPPropertyInfo property = (XMPPropertyInfo) itr.next();

        // Print details of the property
        System.out.println(property.getPath() + ": " + property.getValue());
    }
}

我仍然希望看到一个示例图像,但是从十六进制编辑器中看到了您的屏幕截图,我怀疑 Adob​​e Bridge 正在将字符串截断为 64 字节以用于 IPTC。在线快速搜索表明这是 IPTC 关键字字段的最大长度。

【讨论】:

  • XMP 目录正是我所需要的。标题的全文在路径为“dc:title[1]”的属性中。谢谢你。我会把图片上传到 GitHub。
猜你喜欢
  • 1970-01-01
  • 2019-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-16
相关资源
最近更新 更多