GNU bug report logs - #10747
ImageMagick does not return much metadata

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 7 Feb 2012 04:37:01 UTC

Severity: minor

Found in version 24.0.93

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10747 <at> debbugs.gnu.org, Joakim Verona <joakim <at> verona.se>
Subject: bug#10747: ImageMagick does not return much metadata
Date: Fri, 24 Feb 2012 02:43:32 +0200
tags 10747 patch
thanks

> If I repeat the experiment with (I think this is the way to prefer
> ImageMagick over libgif):
>
> emacs -Q  --eval "(setq image-type-header-regexps nil)" \
>   -f imagemagick-register-types
>
> then the returned metadata is just: (count 44)

It is possible to get the value of delay for using in animated images by
`MagickGetImageDelay' as demonstrated in the trivial patch below.

Good luck implementing SVG animation in 24.2 that is more complicated:
http://www.w3.org/TR/SVG/animate.html
and even unsupported by some browsers:
http://hoffmann.bplaced.net/svgtest/index.php?in=text

=== modified file 'src/image.c'
--- src/image.c	2012-01-25 17:54:01 +0000
+++ src/image.c	2012-02-24 00:38:12 +0000
@@ -7666,6 +7666,12 @@
              Fcons (make_number (MagickGetNumberImages (ping_wand)),
                     img->lisp_data));
 
+  if (MagickGetImageDelay (ping_wand) > 1)
+    img->lisp_data =
+      Fcons (Qdelay,
+             Fcons (make_float (MagickGetImageDelay (ping_wand) / 100.0),
+                    img->lisp_data));
+
   DestroyMagickWand (ping_wand);
 
   /* Now we know how many images are inside the file.  If it's not a

=== modified file 'lisp/image.el'
--- lisp/image.el	2012-01-25 19:45:29 +0000
+++ lisp/image.el	2012-02-24 00:23:08 +0000
@@ -591,7 +591,7 @@ (defmacro defimage (symbol specs &option
 
 ;;; Animated image API
 
-(defconst image-animated-types '(gif)
+(defconst image-animated-types '(gif imagemagick)
   "List of supported animated image types.")
 
 (defun image-animated-p (image)
@@ -601,7 +601,7 @@ (defun image-animated-p (image)
 DELAY is the delay in second until the next sub-image shall be
 displayed."
   (cond
-   ((eq (plist-get (cdr image) :type) 'gif)
+   ((memq (plist-get (cdr image) :type) image-animated-types)
     (let* ((metadata (image-metadata image))
 	   (images (plist-get metadata 'count))
 	   (delay (plist-get metadata 'delay)))





This bug report was last modified 5 years and 302 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.