summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2018-12-14 18:47:28 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2018-12-14 18:47:28 +0100
commit465bca88f750c019f79f7da3b6c0d840b7d06d1e (patch)
tree8fbac24fac15485709c0f679fd43faa1bf94b4c2
parent4d9387931268151bf30dd3d4e1e4435288acb5da (diff)
downloadcataract-465bca88f750c019f79f7da3b6c0d840b7d06d1e.tar.xz
jpeg-utils: ImageMagick 7 adaptations
MagickWand comes with a couple of incompatible API changes in version 7.
-rw-r--r--configure.ac4
-rw-r--r--src/jpeg-utils.cpp12
2 files changed, 15 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 7add77b..cd52d75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,10 @@ AC_MSG_CHECKING(for MagickWand)
magick_wand_version=`$PKG_CONFIG --modversion MagickWand`
AC_MSG_RESULT(yes (version $magick_wand_version))
+PKG_CHECK_EXISTS([MagickWand >= 7],
+ AC_DEFINE(HAVE_IMAGEMAGICK_7, 1,
+ [Define to 1 if ImageMagick 7 is available]))
+
diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp
index 32eb64f..2e214e4 100644
--- a/src/jpeg-utils.cpp
+++ b/src/jpeg-utils.cpp
@@ -15,6 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -22,7 +24,11 @@
#include <exiv2/image.hpp>
#include <exiv2/exif.hpp>
-#include <wand/MagickWand.h>
+#ifdef HAVE_IMAGEMAGICK_7
+# include <MagickWand/MagickWand.h>
+#else
+# include <wand/MagickWand.h>
+#endif
#include <config.h>
@@ -618,7 +624,11 @@ resize_image (const gchar *src, const gchar *dst,
if (thumbnail) {
MagickThumbnailImage (magick_wand, size_x, size_y);
} else {
+#ifdef HAVE_IMAGEMAGICK_7
+ MagickResizeImage (magick_wand, size_x, size_y, LanczosFilter);
+#else
MagickResizeImage (magick_wand, size_x, size_y, LanczosFilter, 1.0);
+#endif
}
} else {
/* Perform resizing through ImageMagick commandline parser */