Fabrizio Giudici is a Senior Java Architect with a long Java experience in the industrial field. He runs Tidalwave, his own consultancy company, and has contributed to Java success stories in a number of fields, including Formula One. Fabrizio often appears as a speaker at international Java conferences such as JavaOne and Devoxx and is member of JUG Milano and the NetBeans Dream Team. Fabrizio is a DZone MVB and is not an employee of DZone and has posted 67 posts at DZone. You can read more from them at their website. View Full User Profile

Reading EXIF and IPTC with Mistral

  • submit to reddit

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);
EXIF exif = image.getMetadata(EXIF.class);
Rational shutterSpeed = getShutterSpeedValue();

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


1343_Overview.png45.36 KB
Your rating: None
Published at DZone with permission of Fabrizio Giudici, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Jonathan Giles replied on Sat, 2009/02/07 - 6:42pm

Very interesting. Do you have any thoughts on the feasibility of writing IPTC data? Cheers, Jonathan

Fabrizio Giudici replied on Sun, 2009/02/08 - 6:18pm

The API has been designed for writing too, it just lacks that part of implementation. The idea is that you just manipulate the EXIF/IPTC bean (it is already possible add, edit and remove tags) and when you execute image.execute(new WriteOp(...)) metadata get written. I need to write the code that converts the data back from the bean to the XML format used by JAI-ImageIO.

Jonathan Giles replied on Sun, 2009/02/08 - 10:33pm in response to: Fabrizio Giudici


Do you have any plans to implement this functionality in the coming weeks or months? Right now I am working on a program that reads and writes IPTC data, and am likely having to buy a commercial license for proprietary Java software (Imagero) to do this. This API is dated and not particularly pleasurable to work with.

If there is any way I can help, let me know and I'll see what I can do. Probably best you email me directly rather than go through this chat board (jo at jogiles.co.nz)



Fabrizio Giudici replied on Wed, 2009/03/04 - 7:47am

I'm sorry that I noticed the last question only now. I don't have a specific timeframe at the moment. The intention is by the end of Summer, but I don't have a good record of respecting the planned schedules for my open source stuff, so at the moment I prefer not to give out dates.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.