diff --git a/configure.ac b/configure.ac
index d18859b..d6dc63b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -971,25 +971,6 @@ AM_CONDITIONAL(HAVE_SPIRO, test "$spiro_ok" = "yes")
AC_SUBST(LIBSPIRO)
-###################
-# Check for exiv2
-###################
-
-AC_ARG_WITH(exiv2, [ --without-exiv2 build without libexiv2 support])
-
-have_libexiv2="no"
-if test "x$with_libexiv2" != "xno"; then
- PKG_CHECK_MODULES(EXIV2, exiv2,
- have_exiv2="yes",
- have_exiv2="no (exiv2 library not found)")
-fi
-
-AM_CONDITIONAL(HAVE_EXIV2, test "$have_exiv2" = "yes")
-
-AC_SUBST(EXIV2_CFLAGS)
-AC_SUBST(EXIV2_CXXFLAGS)
-AC_SUBST(EXIV2_LIBS)
-
###################
# Check for UMFPACK
###################
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 8f1077d..93d83fc 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -26,9 +26,9 @@ AM_LDFLAGS = \
noinst_PROGRAMS = introspect operation_reference img_cmp
-if HAVE_EXIV2
+if HAVE_GEXIV2
noinst_PROGRAMS += exp_combine
exp_combine_SOURCES = exp_combine.cpp
-exp_combine_LDADD = $(EXIV2_LIBS)
-exp_combine_CXXFLAGS = $(AM_CFLAGS) $(EXIV2_CFLAGS)
+exp_combine_LDADD = $(GEXIV2_LIBS)
+exp_combine_CXXFLAGS = $(AM_CFLAGS) $(GEXIV2_CFLAGS)
endif
diff --git a/tools/exp_combine.cpp b/tools/exp_combine.cpp
index efd8e3c..58649b6 100644
--- a/tools/exp_combine.cpp
+++ b/tools/exp_combine.cpp
@@ -8,8 +8,7 @@
#include <iostream>
-#include <exiv2/image.hpp>
-#include <exiv2/exif.hpp>
+#include <gexiv2/gexiv2.h>
using namespace std;
@@ -54,35 +53,32 @@ die:
static gfloat
expcombine_get_file_ev (const gchar *path)
{
- /* Open the file and read in the metadata */
- Exiv2::Image::AutoPtr image;
- try
- {
- image = Exiv2::ImageFactory::open (path);
- image->readMetadata ();
- }
- catch (Exiv2::Error ex)
- {
- g_print ("Error: unable to read metadata from path: '%s'\n", path);
- exit (EXIT_FAILURE);
- }
+ GError *error = NULL;
+ GExiv2Metadata *e2m = gexiv2_metadata_new ();
+ gfloat time, aperture, gain = 1.0f;
- Exiv2::ExifData &exifData = image->exifData ();
- if (exifData.empty ())
- return NAN;
+ gexiv2_metadata_open_path (e2m, path, &error);
+ if (error)
+ {
+ g_warning ("%s", error->message);
+ exit (EXIT_FAILURE);
+ }
/* Calculate the APEX brightness / EV */
- gfloat time, aperture, gain = 1.0f;
- time = exifData["Exif.Photo.ExposureTime"].value().toFloat();
- aperture = exifData["Exif.Photo.FNumber" ].value().toFloat();
+ {
+ gint nom, den;
+ gexiv2_metadata_get_exposure_time (e2m, &nom, &den);
+ time = nom * 1.0f / den;
+ }
+ aperture = gexiv2_metadata_get_fnumber (e2m);
/* iso */
- try
+ if (gexiv2_metadata_has_tag (e2m, "Exif.Image.ISOSpeedRatings"))
{
- gain = exifData["Exif.Photo.ISOSpeedRatings"].value().toLong() / 100.0f;
+ gain = gexiv2_metadata_get_iso_speed (e2m) / 100.0f;
}
- catch (Exiv2::Error ex)
+ else
{
// Assume ISO is set at 100. It's reasonably likely that the ISO is the
// same across all images anyway, and for our purposes the relative