Extracting Geotag Information from Jpeg Images in Java.

While working on a project recently, I ran into a need to be able to extract geotag information from a jpeg image.  I’ve seen many application that do this so I figured it had to be a solved problem.

After a few minutes of searching I found two libraries that looked promising:  Apache Commons Imaging and Drew Noakes’s Metadata-Extractor.  The Apache library hasn’t been updated since 2009 and when trying to download it, I get 404 error.  So I quickly gave up on that library.

Next I tried the Metadata-Extractor; this library is very robust and has options for reading all sorts of exif tags.  I played around a bit with the library and quickly decided I didn’t need the majority of the library’s functions for my project.  Rather than importing the whole library and only using a bit of it, I thought that I would create a slimmed down version.  I condensed the library down to two classes.  Of course much of the functionality has been cut away, but for extracting the geotag information from a jpeg image, it works great.  It fits cleanly into my project and I suspect it will for other projects as well.

So if you have a java project that requires extracting only geotag information from jpeg images check out my project on Github at: https://github.com/alecdhuse/Java-Jpeg-Geotag-Reader  If you are looking for something with more features check out the Metadata Extractor at: http://drewnoakes.com/code/exif/ and Thanks to Drew Nokes for all the hard initial work!

Leave a Reply

Your email address will not be published. Required fields are marked *