How to extract XMP metadata from JPEG files in Java

I needed a way to extract XMP metadata from JPEG files so that my Java based gallery could display more information about the pictures than the standard IPTC fields. I have used a host of different DAM solutions in the past, but Lightroom 2 is currently my favorite and it provides XMP metadata of good quality.

Solution

Previously a pretty crude static utility class was available for download, but it has now been totally rewritten and turned into XMPUtil4J.

More?

I have created a method that uses XMPUtil4J to extract the metadata and write it to an XMP sidecar file next to the JPEG it originated from. It speeds up the process of reading XMP metadata from multiple files and is able to determine when the sidecar file is out of sync with the JPEG and should be rewritten. If it generates enough interest I may write another article about it in the future.