【问题标题】:How can you serialize an XMP XML block to an existing JPEG Image?如何将 XMP XML 块序列化为现有的 JPEG 图像?
【发布时间】:2012-04-22 04:24:31
【问题描述】:

我有许多包含损坏的 XMP XML 块的 JPEG 图像。我可以轻松修复这些块,但我不确定如何将“固定”数据写回图像文件。

我目前正在使用 JAVA,但我愿意接受任何能让这项任务变得简单的事情。

这是前面提到的another question around XMP XML 的目标。

【问题讨论】:

  • 在对 stackoverflow 进行了一些挖掘之后,我遇到了这个问题:stackoverflow.com/questions/1838829/… 这基本上是同一个问题。我现在正在调查答案是否真的适用于我需要的东西。如果有,我会回帖。

标签: java xml jpeg xmp


【解决方案1】:

在 JAVA 中你可以使用Apache Sanselan library:

String newXmpXmlString = "<the><new/><xmp/><xml/></the>";
File file = new File('path/to/file');
new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(file), new BufferedOutputStream(new FileOutputStream(file)), newXmpXmlString);

有关上述解决方案的更详细示例,Google Code 上有一个开源项目,其中包含一个小的 jPeg XMP XML Trimmer。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-21
    • 1970-01-01
    • 2014-01-20
    • 1970-01-01
    • 1970-01-01
    • 2010-10-12
    相关资源
    最近更新 更多