The gpsdings JNI library
Via the gpsdings JNI library,
exifloc -e can directly use the C++
library libexiv2 to write gps exif information to digital photographs. When you
use the exiv2 (or exiftool) standalone executable a new system process is
started for each image. In constrast, gpsdingsjni/libexiv2 stays in memory once
loaded, and the overhead of creating a new process for each image is avoided.
Therefore, in theory, gpsdingsjni/libexiv2 should be faster than the exiv2
executable. However, when the image files are large, disk I/O may come to
dominate the processing time so that the speed advantage of gpsdingsjni/libexiv2
over standalone exiv2 becomes minimal (see
timing results below).
There are binaries of the library for Linux and Windows on the sf.net download page. The binaries provided have been built using gcc 3.4.4 under Cygwin and gcc 4.0.2 20050901 (prerelease) under SUSE Linux. Put the library file suitable for your platform into the same directory as gpsdings.jar.
Building from source
- Download the GPSdings jni sources with
svn export https://svn.code.sf.net/p/gpstools/code/trunk/jniand cd to the
- Download the exiv2 source tarball, unpack it, and build it:
wget http://exiv2.org/exiv2-0.23.tar.gz tar xvzf exiv2-0.23.tar.gz cd exiv2-0.23 ./configure --disable-xmp --without-zlib --disable-nls make cd ..On Cygwin, you must do
export CXXFLAGS=-mno-cygwin export CFLAGS=-mno-cygwinbefore calling
./configure. I also had to manually edit
config.hchanging the line
#define HAVE_SYS_MMAN_H 1to
#undef HAVE_SYS_MMAN_Hon Cygwin.
- Install a java sdk if necessary in order to obtain the jni header files.
- Compile JNIExiv2.cpp from the gpsdingsjni source package. With
antyou can use the provided build scripts (build.xml with win32.properties or unix.properties). You may have to change the locations of the JNI headers, the exiv2 headers (
<exiv2dir>/src) as well as the exiv2 library location (
<exiv2dir>/src/.libs/libexiv2.a). The build target
<gpsdingsjni>must be called
gpsdingsjni.dllon Windows and
<gpsdingsjni>to the directory containing the
You are ready to use gpsdingsjni/libexiv2 with exifloc. If you copied libgpsdingsjni.so/gpsdingsjni.dll to your library path or to the directory where gpsdings.jar resides you can use exifloc -e without argument. Otherwise you need to specify the path to the library file.