summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-09-24 19:47:20 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-09-24 19:47:20 +0200
commit13f244af4044bf250307889bd6cd974ee665d01a (patch)
tree6a75fb28f93553f9c0556ac89a37c51425a9d653
parent7823dcf2fb0ac2bd1d0349be683a618d332758ff (diff)
downloademacs-13f244af4044bf250307889bd6cd974ee665d01a.tar.gz
Make ImageMagick multi-image size calculations work for .ico files
* src/image.c (imagemagick_load_image): Compute image sizes correctly in multi-image .ico files and the like (bug#18333).
-rw-r--r--src/image.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c
index 06a8154842c..7cf1bc4c362 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8896,12 +8896,28 @@ imagemagick_load_image (struct frame *f, struct image *img,
"super-wand". */
if (MagickGetNumberImages (image_wand) > 1)
{
- MagickWand *super_wand = image_wand;
- image_wand = imagemagick_compute_animated_image (super_wand, ino);
- if (! image_wand)
- image_wand = super_wand;
+ /* This is an animated image (it has a delay), so compute the
+ composite image etc. */
+ if (MagickGetImageDelay (image_wand) > 0)
+ {
+ MagickWand *super_wand = image_wand;
+ image_wand = imagemagick_compute_animated_image (super_wand, ino);
+ if (! image_wand)
+ image_wand = super_wand;
+ else
+ DestroyMagickWand (super_wand);
+ }
else
- DestroyMagickWand (super_wand);
+ /* This is not an animated image: It's just a multi-image file
+ (like an .ico file). Just return the correct
+ sub-image. */
+ {
+ MagickWand *super_wand = image_wand;
+
+ MagickSetIteratorIndex (super_wand, ino);
+ image_wand = MagickGetImage (super_wand);
+ DestroyMagickWand (super_wand);
+ }
}
/* Retrieve the frame's background color, for use later. */