fix build with graphicsmagick

GM is still using the old page interface of subimage/subrange, IM has
deprecated that in favour of scene/number_scenes

we were accidentally just supporting the new IM system ... this change
adds support for GM as well, plus a configure test to pick one

see https://github.com/jcupitt/libvips/issues/423
This commit is contained in:
John Cupitt 2016-04-18 15:21:11 +01:00
parent f0271f050d
commit 23eaf93867
3 changed files with 28 additions and 4 deletions

View File

@ -2,6 +2,7 @@
- rename vips wrapper script, it was still vips-8.2, thanks Benjamin
- export C++ operator overloads for MSVC linking [Lovell]
- insist on giflib4
- fix magickload @page with GraphicsMagick
29/1/16 started 8.3
- add vips_reduce*() ... a fast path for affine downsize

View File

@ -488,6 +488,19 @@ if test x"$with_magick" != "xno"; then
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_CHECK_MEMBER([struct _ImageInfo.number_scenes],
AC_DEFINE(HAVE_NUMBER_SCENES,1,
[define if your magick has ImageInfo.number_scenes.]),
[],
[#include <magick/api.h>])
CFLAGS=$save_CFLAGS
fi
# orc
AC_ARG_WITH([orc],
AS_HELP_STRING([--without-orc], [build without orc (default: test)]))

View File

@ -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