문제

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.

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

This is the goal for another question around XMP XML asked earlier.

도움이 되었습니까?

해결책

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);

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top