improve imagemagick init

graphicsmagick, in some configurations, needs to be told to init the
various loaders.

Thanks @LebronCurry

See https://github.com/libvips/libvips/issues/1528
This commit is contained in:
John Cupitt 2020-01-15 14:42:58 +00:00
parent 6605029bc3
commit fc9edfe593
2 changed files with 13 additions and 1 deletions

View File

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

View File

@ -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 );
}