emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 13f244a: Make ImageMagick multi-image size calculat


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 13f244a: Make ImageMagick multi-image size calculations work for .ico files
Date: Tue, 24 Sep 2019 13:47:38 -0400 (EDT)

branch: master
commit 13f244af4044bf250307889bd6cd974ee665d01a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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).
---
 src/image.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index 06a8154..7cf1bc4 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.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]