如何将XMP XML块序列化为现有JPEG图像? [英] How can you serialize an XMP XML block to an existing JPEG Image?

查看:142
本文介绍了如何将XMP XML块序列化为现有JPEG图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多JPEG图像,其中包含损坏的XMP XML块。我可以很容易地修复这些块,但我不确定如何将固定数据写回图像文件。

I have many JPEG images which contain corrupted XMP XML blocks. I can easily fix these blocks but I'm unsure how to write the 'fixed' data back to the image files.

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

I'm currently using JAVA but am open to anything that will make this task easy.

这是另一个围绕XMP XML的问题早先问过。

推荐答案

在JAVA中,您可以使用 Apache Sanselan库

In JAVA you can use the 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修剪器

For a more detailed example of the solution outlined above there is an open source project on Google Code that houses a small jPeg XMP XML Trimmer.

这篇关于如何将XMP XML块序列化为现有JPEG图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆