unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10747: ImageMagick does not return much metadata
@ 2012-02-07  4:35 Glenn Morris
  2012-02-24  0:43 ` Juri Linkov
  2019-09-24 17:53 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Glenn Morris @ 2012-02-07  4:35 UTC (permalink / raw)
  To: 10747; +Cc: Joakim Verona

Package: emacs
Version: 24.0.93

As an example animated gif file, I use:
http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Rotating_earth_%28large%29.gif/200px-Rotating_earth_%28large%29.gif

In an Emacs compiled with both libgif and ImageMagick support:

emacs -Q file.gif

then in the resulting image-mode buffer, 
(image-metadata (image-get-display-property))
returns:

(count 44 delay 0.09 extension-data (0 "control-chars" 255 "NETSCAPE2.0" 254
"File source: http://commons.wikimedia.org/wiki/File:Rotating_earth_(large).gif"
249 "control-chars"))

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)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10747: ImageMagick does not return much metadata
  2012-02-07  4:35 bug#10747: ImageMagick does not return much metadata Glenn Morris
@ 2012-02-24  0:43 ` Juri Linkov
  2012-04-17  2:01   ` Glenn Morris
  2014-09-18 21:02   ` Juri Linkov
  2019-09-24 17:53 ` Lars Ingebrigtsen
  1 sibling, 2 replies; 6+ messages in thread
From: Juri Linkov @ 2012-02-24  0:43 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 10747, Joakim Verona

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
 \f
 ;;; 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)))






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10747: ImageMagick does not return much metadata
  2012-02-24  0:43 ` Juri Linkov
@ 2012-04-17  2:01   ` Glenn Morris
  2012-09-29 19:39     ` Juri Linkov
  2014-09-18 21:02   ` Juri Linkov
  1 sibling, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2012-04-17  2:01 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 10747, Joakim Verona

Juri Linkov wrote:

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

You could install this in the trunk now if you like.
I don't consider it a complete solution because there is other metadata
besides delay.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10747: ImageMagick does not return much metadata
  2012-04-17  2:01   ` Glenn Morris
@ 2012-09-29 19:39     ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2012-09-29 19:39 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 10747, Joakim Verona

>> It is possible to get the value of delay for using in animated images by
>> `MagickGetImageDelay' as demonstrated in the trivial patch below.
>
> You could install this in the trunk now if you like.
> I don't consider it a complete solution because there is other metadata
> besides delay.

I have not yet installed this patch because the property `delay'
is necessary for animated gifs, but they are still not working
with ImageMagick.  The same image is displayed for every value
of the :index parameter of the animated gif.  This bug is reported at
bug#7978.  Maybe this bug exists only in old ImageMagick libraries.
I'll try to get the latest version of ImageMagick to confirm whether
it improves that.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10747: ImageMagick does not return much metadata
  2012-02-24  0:43 ` Juri Linkov
  2012-04-17  2:01   ` Glenn Morris
@ 2014-09-18 21:02   ` Juri Linkov
  1 sibling, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2014-09-18 21:02 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 10747, Joakim Verona

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

This patch was installed for bug#18334.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10747: ImageMagick does not return much metadata
  2012-02-07  4:35 bug#10747: ImageMagick does not return much metadata Glenn Morris
  2012-02-24  0:43 ` Juri Linkov
@ 2019-09-24 17:53 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-24 17:53 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 10747, Joakim Verona

Glenn Morris <rgm@gnu.org> writes:

> then in the resulting image-mode buffer, 
> (image-metadata (image-get-display-property))
> returns:
>
> (count 44 delay 0.09 extension-data (0 "control-chars" 255 "NETSCAPE2.0" 254
> "File source: http://commons.wikimedia.org/wiki/File:Rotating_earth_(large).gif"
> 249 "control-chars"))
>
> 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)

ImageMagick does return the delay in the metadata, and I think the rest
of the metadata isn't very interesting (especially as we don't recommend
compiling Emacs with ImageMagick these days), so I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-24 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07  4:35 bug#10747: ImageMagick does not return much metadata Glenn Morris
2012-02-24  0:43 ` Juri Linkov
2012-04-17  2:01   ` Glenn Morris
2012-09-29 19:39     ` Juri Linkov
2014-09-18 21:02   ` Juri Linkov
2019-09-24 17:53 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).