这与Extract IPTC-Keywords Longer than 64 Chars in Java密切相关.请在那里查看我的评论。
问题是在 Adobe Bridge 中添加到 JPEG 文件的标题在描述选项卡中作为“文档标题”(在 Windows 文件属性对话框的“详细信息”选项卡中也显示为“标题”)最终出现在两个位置JPEG 文件,可以在文件的十六进制显示中看到。一个有完整的标题,一个只有 64 个字符。
我可以通过检索所有元数据目录中的所有标签描述来获取截断的标题(标签名称“对象名称”),但我无法获取完整标题。
这是一个示例文件,其嵌入的标题是“Early morning on the spit between Waiohai Beach Club and Poipu Beach Park”:
最佳答案
我很乐意为您看看这个。但是 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());
}
}
我仍然想看一个示例图像,但是从十六进制编辑器中看到了您的屏幕截图,我怀疑 Adobe Bridge 正在将字符串截断为 IPTC 的 64 字节。在线快速搜索表明这是 IPTC 关键字字段的最大长度。
关于java - 无法从 JPEG 元数据中检索标题的全文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39947822/