The gpsdings JNI library
Via the gpsdings JNI library, gpsdings
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).
Installation
Binaries
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/jni
and cd to thejni
directory. - 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 doexport CXXFLAGS=-mno-cygwin export CFLAGS=-mno-cygwin
before calling./configure
. I also had to manually editconfig.h
changing the line#define HAVE_SYS_MMAN_H 1
to#undef HAVE_SYS_MMAN_H
on Cygwin. - Install a java sdk if necessary in order to obtain the jni header files.
- Compile JNIExiv2.cpp from the gpsdingsjni source package. With
ant
you 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 calledgpsdingsjni.dll
on Windows andlibgpsdingsjni.so
on Unix. - Copy
<gpsdingsjni>
to the directory containing thegpsdings.jar
file.
Using it
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.