Finally it seems that I’ve found a pure Java Library that can read and write XMP Data to and from JPEGs!
In the past time I’ve been googling for such a library repeatedly. There are quite some libraries for just reading EXIF or IPTC data. Amongst others are Drew Noakes’ library and Imagero. As I am on the verge of adding more metadata functionality to my self-made image database I had 2 issues:
- A decision of how to store labels and descriptions to images: a database only without touching the images or IPTC, XMP within images (with cached information to a database). Finally I decided that I wanted to use XMP(or IPTC so that the information is kept close to the image.
- A library for this!
What I’ve found so far (incomplete listing as I came across QUITE some libs for reading data):
Imagero and Drew Noakes: Until now I was using Drew Noakes library for reding EXIF data – which was absolutely okay but couldn’t write any data 🙁 Imagero supports writing of IPTC and XMP (from what I’ve read) and is even free for non-commercial usage. But it’s not true open source and you need to request a licence every year (which works w/out problems!). Judging the work Andrey Kusnetsov (maintainer of Imagero) is putting into it I think, that’s quite acceptable.
Adobe XMP SDK: Adobe – as the inventor of XMP – has released an SDK for reading/writing XMP. Most of the SDK is written in C, the SDK Core is also available in Java (great!) but the functionality to get and write the XMP to and from files .. is not available as Java. Quite annoying.
Apache Sanselan: When searching for Apache Sanselan you most likely end up at the incubator-site which says that the project is in the stat of migrating into apache – the mailinglist also doesn’t work. The simple reason: Sanselan is already a part of Apache Commons. So, this new link is the place to go. The most interesting thing of Sanselan is the format support:
- JPEG IPTC support: read (yes), write (soon), Can read IPTC data from exsiting JPEG/JFIF files WITHOUT modifying image data.
- JPEG EXIF: read (yes), write (yes), Can read and write EXIF data to and from exsiting JPEG/JFIF files WITHOUT modifying image data.
- XMP: read (yes), write (yes), Can read XMP XML (as as String) from […] JPEG […]. Can remove, insert and update XMP XML into existing JPEG files.
Update: the downside of Sanselan is that development seems to have stalled. The current release is 0.97 from February 14th, 2009. :-(((