Created
April 18, 2016 19:38
-
-
Save felixbuenemann/6862526323514cb7684b81cb88593d0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/configure 2016-04-18 21:26:28.000000000 +0200 | |
+++ b/configure 2016-04-18 21:26:37.000000000 +0200 | |
@@ -2439,6 +2439,63 @@ | |
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
} # ac_fn_c_check_type | |
+ | |
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES | |
+# ---------------------------------------------------- | |
+# Tries to find if the field MEMBER exists in type AGGR, after including | |
+# INCLUDES, setting cache variable VAR accordingly. | |
+ac_fn_c_check_member () | |
+{ | |
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 | |
+$as_echo_n "checking for $2.$3... " >&6; } | |
+if eval \${$4+:} false; then : | |
+ $as_echo_n "(cached) " >&6 | |
+else | |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
+/* end confdefs.h. */ | |
+$5 | |
+int | |
+main () | |
+{ | |
+static $2 ac_aggr; | |
+if (ac_aggr.$3) | |
+return 0; | |
+ ; | |
+ return 0; | |
+} | |
+_ACEOF | |
+if ac_fn_c_try_compile "$LINENO"; then : | |
+ eval "$4=yes" | |
+else | |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
+/* end confdefs.h. */ | |
+$5 | |
+int | |
+main () | |
+{ | |
+static $2 ac_aggr; | |
+if (sizeof ac_aggr.$3) | |
+return 0; | |
+ ; | |
+ return 0; | |
+} | |
+_ACEOF | |
+if ac_fn_c_try_compile "$LINENO"; then : | |
+ eval "$4=yes" | |
+else | |
+ eval "$4=no" | |
+fi | |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
+fi | |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
+fi | |
+eval ac_res=\$$4 | |
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
+$as_echo "$ac_res" >&6; } | |
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
+ | |
+} # ac_fn_c_check_member | |
cat >config.log <<_ACEOF | |
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
@@ -21778,6 +21835,22 @@ | |
LIBS=$save_LIBS | |
fi | |
+if test x"$with_magick" != "xno"; then | |
+ # do we have number_scenes in image_info ... imagemagick uses this, gm | |
+ # still uses subrange | |
+ save_CFLAGS=$CFLAGS | |
+ CFLAGS="$CFLAGS $MAGICK_CFLAGS" | |
+ ac_fn_c_check_member "$LINENO" "struct _ImageInfo" "number_scenes" "ac_cv_member_struct__ImageInfo_number_scenes" "#include <magick/api.h> | |
+" | |
+if test "x$ac_cv_member_struct__ImageInfo_number_scenes" = xyes; then : | |
+ | |
+$as_echo "#define HAVE_NUMBER_SCENES 1" >>confdefs.h | |
+ | |
+fi | |
+ | |
+ CFLAGS=$save_CFLAGS | |
+fi | |
+ | |
# orc | |
# Check whether --with-orc was given. | |
diff --git a/libvips/foreign/magick2vips.c b/libvips/foreign/magick2vips.c | |
index ae3d4e5..288cbf5 100644 | |
--- a/libvips/foreign/magick2vips.c | |
+++ b/libvips/foreign/magick2vips.c | |
@@ -49,6 +49,8 @@ | |
* fd during file read, handy for large numbers of input images | |
* 14/2/16 | |
* - add @page option, 0 by default | |
+ * 18/4/16 | |
+ * - fix @page with graphicsmagick | |
*/ | |
/* | |
@@ -217,16 +219,24 @@ read_new( const char *filename, VipsImage *im, | |
#endif /*HAVE_SETIMAGEOPTION*/ | |
if( !all_frames ) { | |
+#ifdef HAVE_NUMBER_SCENES | |
+ /* I can't find docs for these fields, but this seems to work. | |
+ */ | |
char page[256]; | |
- /* Just pick a specific page. | |
- * | |
- * I can't find docs for these fields, but this seems to work. | |
- */ | |
read->image_info->scene = read->page; | |
read->image_info->number_scenes = 1; | |
+ | |
+ /* Some IMs must have the string version set as well. | |
+ */ | |
vips_snprintf( page, 256, "%d", read->page ); | |
read->image_info->scenes = strdup( page ); | |
+#else /*!HAVE_NUMBER_SCENES*/ | |
+ /* This works with GM 1.2.31 and probably others. | |
+ */ | |
+ read->image_info->subimage = read->page; | |
+ read->image_info->subrange = 1; | |
+#endif | |
} | |
#ifdef DEBUG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment