bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10747: ImageMagick does not return much metadata


From: Juri Linkov
Subject: bug#10747: ImageMagick does not return much metadata
Date: Fri, 24 Feb 2012 02:43:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu)

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)))






reply via email to

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