imagemagick-types needs to initialize ImageMagick

* src/image.c (imagemagick_initialize): New function,
with body taken from imagemagick_load_image.
(imagemagick_load_image, Fimagemagick_types): Use it.
Copyright-paperwork-exempt: yes
This commit is contained in:
Dhruva Krishnamurthy 2019-12-23 17:20:06 -08:00 committed by Paul Eggert
parent 9eb871c8d1
commit ee12c421b6

View file

@ -8603,6 +8603,17 @@ extern WandExport void PixelGetMagickColor (const PixelWand *,
MagickPixelPacket *); MagickPixelPacket *);
#endif #endif
static void
imagemagick_initialize (void)
{
static bool imagemagick_initialized;
if (!imagemagick_initialized)
{
imagemagick_initialized = true;
MagickWandGenesis ();
}
}
/* Log ImageMagick error message. /* Log ImageMagick error message.
Useful when an ImageMagick function returns the status `MagickFalse'. */ Useful when an ImageMagick function returns the status `MagickFalse'. */
@ -8874,14 +8885,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
double rotation; double rotation;
char hint_buffer[MaxTextExtent]; char hint_buffer[MaxTextExtent];
char *filename_hint = NULL; char *filename_hint = NULL;
imagemagick_initialize ();
/* Initialize the ImageMagick environment. */
static bool imagemagick_initialized;
if (!imagemagick_initialized)
{
imagemagick_initialized = true;
MagickWandGenesis ();
}
/* Handle image index for image types who can contain more than one image. /* Handle image index for image types who can contain more than one image.
Interface :index is same as for GIF. First we "ping" the image to see how Interface :index is same as for GIF. First we "ping" the image to see how
@ -9290,6 +9294,7 @@ and `imagemagick-types-inhibit'. */)
char **imtypes; char **imtypes;
size_t i; size_t i;
imagemagick_initialize ();
ex = AcquireExceptionInfo (); ex = AcquireExceptionInfo ();
imtypes = GetMagickList ("*", &numf, ex); imtypes = GetMagickList ("*", &numf, ex);
DestroyExceptionInfo (ex); DestroyExceptionInfo (ex);