Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Reading EXIF and IPTC with Mistral

DZone's Guide to

Reading EXIF and IPTC with Mistral

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

While you may have seen me blogging and posting stories about my main projects, I've realized that some of the smaller subprojects didn't receive much attention from me in the last year. For instance Mistral, which is a meta-framework for imaging. "Meta-framework" means that it doesn't provide its own imaging code, but just abstracts some common libraries, such as Java2D or JAI (and others could be plugged in).

One of the benefits of Mistral is its simplified APIs. For instance, it's well known that often extracting metadata from images in Java is a pain in the ass. With Mistral is as easy as:

EditableImage image = EditableImage.create(new ReadOp(new File(...)));
IPTC iptc = image.getMetadata(IPTC.class);
System.err.println(iptc.getSubject());
EXIF exif = image.getMetadata(EXIF.class);
Rational shutterSpeed = getShutterSpeedValue();
System.err.println(shutterSpeed.doubleValue());

Every EXIF and most of IPTC properties are accessible with standard getter methods. Furthermore, IPTC and EXIF are fully equipped JavaBeans with bound properties (i.e. PropertyChangeEvent support), which means easy integration with Swing applications. Of course, if you prefer you can even use numeric indexes of tags as in:

EXIF exif = ...
Integer value = exif.getObject(256, Integer.class);

Mistral received just a few changes recently since at the moment it's fine for my needs. But I've received some posts from people using it (and even a couple of code contributions), so - time allowing - I'll fix a couple of remaining things to productize it (at the moment you have to get the latest version by checking out sources from mistral.dev.java.net).

 

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}