Can you recommend a library that lets me add XMP data to a TIFF file? Preferably a library that can be used with Java.
Asked
Active
Viewed 1,353 times
2
-
The solution on this question will likely work for a TIFF as well: http://stackoverflow.com/questions/10265206/how-can-you-serialize-an-xmp-xml-block-to-an-existing-jpeg-image/10291491#10291491 – Randyaa Apr 24 '12 at 03:49
2 Answers
1
There is JempBox which is open source and allows the manipulation of XMP streams, but it doesn't look like it will read/write the XMP data in a TIFF file.
There is also Chilkat which is not open source, but does appear to do what you want.

Adam Goode
- 7,380
- 3
- 29
- 33
0
It's been a while, but it may still be useful to someone: Apache Commons has a library called Sanselan suitable for this task. It's a bit dated and the documentation is sparse, but it does the job well nevertheless:
File file = new File("path/to/your/file");
// Get XMP xml data from a file
String xml = Sanselan.getXmpXml(file);
// Process the XML data
xml = processXml(xml);
// Write XMP xml data from a file
Map params = new HashMap();
params.put(Sanselan.PARAM_KEY_XMP_XML, xml);
BufferedImage image = Sanselan.getBufferedImage(file);
Sanselan.writeImage(image, file, Sanselan.guessFormat(file), params);
You may have to be careful with multipage TIFFs though, because Sanselan.getBufferedImage
will probably only get the first (so only the first gets written back).

Daerst
- 954
- 7
- 24