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

Are you joining the containers revolution? Start leveraging container management using Platform9's ultimate guide to Kubernetes deployment.

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

 

Moving towards a private or Hybrid cloud infrastructure model? Get started with our OpenStack Deployment Models guide to learn the proper deployment model for your organization.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}