diff options
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/image.c b/src/image.c index 70d932f9edb..fc90c5ea74b 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -8603,6 +8603,17 @@ extern WandExport void PixelGetMagickColor (const PixelWand *, | |||
| 8603 | MagickPixelPacket *); | 8603 | MagickPixelPacket *); |
| 8604 | #endif | 8604 | #endif |
| 8605 | 8605 | ||
| 8606 | static void | ||
| 8607 | imagemagick_initialize (void) | ||
| 8608 | { | ||
| 8609 | static bool imagemagick_initialized; | ||
| 8610 | if (!imagemagick_initialized) | ||
| 8611 | { | ||
| 8612 | imagemagick_initialized = true; | ||
| 8613 | MagickWandGenesis (); | ||
| 8614 | } | ||
| 8615 | } | ||
| 8616 | |||
| 8606 | /* Log ImageMagick error message. | 8617 | /* Log ImageMagick error message. |
| 8607 | Useful when an ImageMagick function returns the status `MagickFalse'. */ | 8618 | Useful when an ImageMagick function returns the status `MagickFalse'. */ |
| 8608 | 8619 | ||
| @@ -8874,14 +8885,7 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8874 | double rotation; | 8885 | double rotation; |
| 8875 | char hint_buffer[MaxTextExtent]; | 8886 | char hint_buffer[MaxTextExtent]; |
| 8876 | char *filename_hint = NULL; | 8887 | char *filename_hint = NULL; |
| 8877 | 8888 | imagemagick_initialize (); | |
| 8878 | /* Initialize the ImageMagick environment. */ | ||
| 8879 | static bool imagemagick_initialized; | ||
| 8880 | if (!imagemagick_initialized) | ||
| 8881 | { | ||
| 8882 | imagemagick_initialized = true; | ||
| 8883 | MagickWandGenesis (); | ||
| 8884 | } | ||
| 8885 | 8889 | ||
| 8886 | /* Handle image index for image types who can contain more than one image. | 8890 | /* Handle image index for image types who can contain more than one image. |
| 8887 | Interface :index is same as for GIF. First we "ping" the image to see how | 8891 | Interface :index is same as for GIF. First we "ping" the image to see how |
| @@ -9290,6 +9294,7 @@ and `imagemagick-types-inhibit'. */) | |||
| 9290 | char **imtypes; | 9294 | char **imtypes; |
| 9291 | size_t i; | 9295 | size_t i; |
| 9292 | 9296 | ||
| 9297 | imagemagick_initialize (); | ||
| 9293 | ex = AcquireExceptionInfo (); | 9298 | ex = AcquireExceptionInfo (); |
| 9294 | imtypes = GetMagickList ("*", &numf, ex); | 9299 | imtypes = GetMagickList ("*", &numf, ex); |
| 9295 | DestroyExceptionInfo (ex); | 9300 | DestroyExceptionInfo (ex); |