What is J-ExifTool
J-ExifTool is the first open-source, cross platform Java7 library which allows you to read and write Exif tags from any image file. J-ExifTool uses the ExifTool by Phil Harvey to accomplish this. The ExifTool library has been around for a long time and is probably one of the best tools to manipulate exif tags.
J-ExifTool is very, very beta at the moment and the feature-set is relatively limited, but if you find any bugs, feel free to report them.
Contact the developer
You can contact me directly via:
See the Changelog for more info.
J-ExifTool is released under Apache 2.0 license.
How to use
J-ExifTool uses ExifTool 8.91 or later, you can grab it here. There are two ways to tell J-ExifTool where this executable is located, either via a system property exiftool.path or via an environment variable EXIFTOOL_PATH. Either of two must point to the exiftool executable, if not done correctly, J-ExifTool will not work.
Under normal circumstances you should only need to use the classes in the be.pw.jexif package, everything stored under be.pw.jexif.internal is for internal use only (duh !).
Check the examples page for some more getting started info.
There are a few system properties which you can or have to set:
- be.pw.jexif.internal.constants.ExecutionConstant.EXIFTOOLPATH: must be set to the path where the ExifTool binary is stored if there is no EXIFTOOL_PATH environment variable.
- be.pw.jexif.internal.constants.ExecutionConstant.EXIFTOOLDEADLOCK: can be set to a timeout in miliseconds before the library stops waiting for the ExifTool binary to respond. Default is 4000.
- be.pw.jexif.internal.constants.ExecutionConstant.EXIFTOOLBYPASSVALIDATION: can be set to true if you don't want J-ExifTool to validate the textual input when writing something in a tag. Be aware that ExifTool itself won't allow you to write anything 'wrong'.
- be.pw.jexif.internal.constants.ExecutionConstant.EXIFTOOLCLIENCODING: encoding of the command line. Can be changed to your local code page when J-ExifTool has troubles with parsing special characters. Default is UTF-8 for Linux/Mac and Cp850 for Windows.
J-ExifTool is built using the following libraries:
- Java 7
- Apache Commons Exec (since v0.0.5)
- Cal10n (for i18n of error messages)
- Google Guava (for many stuff)
- SLF4J (logging, currently comes with Log4J)
- TestNG (Unit test)
- Fest-assert (Unit test)
Building the library
J-ExifTool uses maven 2 or 3 to compile, package and release J-ExifTool.
Deadlocked after iteration of x
This error indicates that J-ExifTool waited too long for the ExifTool output to finish. This happens if
- ExifTool isn't running
- You computer is too slow or too busy
The current timeout is set to 4000ms, but you can always override this by setting the exiftool.deadlock system property.
I'm no UML hero but here is an attempt of a sequence diagram for the getTagValue method. I did not model return values because that would make the diagram a lot more complex. The colors are:
- blue: the public API
- yellow: objects which push actions to ExifTool and collect the output
- green: objects interaction directly with ExifTool
- pink: objects responsible for parsing the ExifTool output