diff --git a/ChangeLog b/ChangeLog index 8272ecdd..3ebe6539 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ - fix thumbnail autorot [janko] - fix a warning with magicksave with no delay array [chregu] - fix a race in tiled tiff load [kleisauke] +- better imagemagick init [LebronCurry] 20/6/19 started 8.9.0 - add vips_image_get/set_array_int() diff --git a/libvips/foreign/magick.c b/libvips/foreign/magick.c index 1df52924..3825744d 100644 --- a/libvips/foreign/magick.c +++ b/libvips/foreign/magick.c @@ -636,6 +636,8 @@ magick_vips_error( const char *domain, ExceptionInfo *exception ) static void * magick_genesis_cb( void *client ) { + ExceptionInfo *exception; + #ifdef DEBUG printf( "magick_genesis_cb:\n" ); #endif /*DEBUG*/ @@ -643,9 +645,18 @@ magick_genesis_cb( void *client ) #if defined(HAVE_MAGICKCOREGENESIS) || defined(HAVE_MAGICK7) MagickCoreGenesis( vips_get_argv0(), MagickFalse ); #else /*!HAVE_MAGICKCOREGENESIS*/ - InitializeMagick( "" ); + InitializeMagick( vips_get_argv0() ); #endif /*HAVE_MAGICKCOREGENESIS*/ + /* This forces *magick to init all loaders. We have to do this so we + * can sniff files with GetImageMagick(). + * + * We don't care about errors from magickinit. + */ + exception = magick_acquire_exception(); + (void) GetMagickInfo( "*", exception ); + magick_destroy_exception(exception); + return( NULL ); }