Convert animated gif - delay 0 problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Der_Kevin
Posts: 4
Joined: 2015-11-09T02:48:24-07:00
Authentication code: 1151

Convert animated gif - delay 0 problem

Post by Der_Kevin »

Hey Folks!
I discovered ImageMagick threw this article: http://jacobsalmela.com/make-animated-g ... ght-click/
and searching a way to convert a bunch of single frames into some gifs for my porfolio.

so, i did everything that is written in the article and it works pretty fine so far.

Image

just some details are wrong ;) as you can see
1. the background is weird - it seams that all frames are getting overlapped somehow?
2. the background of the gif is transparent, how can i say that the background should be black? even if the source images are transparent. maybe this even solves problem 1?
by the way, here are the frames:
Image

3. the delay is somehow not 0? or at least it feeals to me that the FPS is wrong?

Thanks for your help!
Kev
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert animated gif - delay 0 problem

Post by snibgo »

Advice is difficult when you don't tell us the command you used, or the version of IM you are using, nor provide the actual PNG input files.
snibgo's IM pages: im.snibgo.com
Der_Kevin
Posts: 4
Joined: 2015-11-09T02:48:24-07:00
Authentication code: 1151

Re: Convert animated gif - delay 0 problem

Post by Der_Kevin »

sorry, input looks like this in the automator: (its from the article above)
/usr/local/bin/convert -delay 0 -loop 0 "$@" ~/Desktop/animated.gif

version is 6.9.0-3

and here are the pngs:
https://www.dropbox.com/s/3tij2ohp0hhqh ... v.zip?dl=0

thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert animated gif - delay 0 problem

Post by snibgo »

This command works fine for me, displaying all 80 frames in about 4 seconds:

Code: Select all

convert -delay 0 -loop 0 frame_*.png -background Black -alpha Remove -layers Optimize a.gif
"-background Black -alpha Remove" makes the background black. If you want the transparency, remove those words. "-layers Optimize" optimize kaes the output gif smaller.

For "-delay", see http://www.imagemagick.org/script/comma ... .php#delay . Drawing each frame takes time.
snibgo's IM pages: im.snibgo.com
Der_Kevin
Posts: 4
Joined: 2015-11-09T02:48:24-07:00
Authentication code: 1151

Re: Convert animated gif - delay 0 problem

Post by Der_Kevin »

okay, thanks. that solves the first two problems.
looks like this now:
Image
and my animator script looks like this:
/usr/local/bin/convert -delay 0 -loop 0 -background Black -alpha Remove -layers Optimize "$@" ~/Desktop/animated.gif
(had to remove the "frame_*.png" since it didn't worked with it inside the mac automator)

the same sequence exported from photoshop:
Image
(forgot to make it loop-able but thats easy) but you see the difference? its running with 60FPS, can i also raise the FPS in imagemagick? cause i think now it must be 30 or something?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert animated gif - delay 0 problem

Post by fmw42 »

It is puzzling to me why using -delay 0 is slower than using -delay 5. Perhaps it is reading some delay value in your images and using that in stead of 0.

I took the slow animated gif and regenerated it with -delay 2 and it runs a lot faster. You can adjust the delay to whatever value you want. Delays are in tics (1/100 sec). See http://www.imagemagick.org/script/comma ... .php#delay. So 60 frames/sec would be 100tics/60 = 1.7 or about 2

Code: Select all

convert -delay 2 animated.gif -coalesce -layers optimize -loop 0 new_animation.gif
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert animated gif - delay 0 problem

Post by glennrp »

Bear in mind that for GIFs, "-delay 0" means "-delay .01 second". coders/gif.c seems to enforce that on writing but not on reading, and animate.c interprets 0 delay as 1 tick..
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert animated gif - delay 0 problem

Post by fmw42 »

glennrp wrote:Bear in mind that for GIFs, "-delay 0" means "-delay .01 second". coders/gif.c seems to enforce that on writing but not on reading, and animate.c interprets 0 delay as 1 tick..
I am not sure that it is working that way. Correct me if I am wrong, but .01 sec is 1 tic (so equivalent to -delay 1). Using -delay 0 produces a much longer animation than using -delay 2.

Using the slow animation above,

Code: Select all

convert -delay 0 animated.gif -coalesce -layers optimize -loop 0 tmp0.gif
the resulting animation plays much slower than

Code: Select all

convert -delay 2 animated.gif -coalesce -layers optimize -loop 0 tmp2.gif
Der_Kevin
Posts: 4
Joined: 2015-11-09T02:48:24-07:00
Authentication code: 1151

Re: Convert animated gif - delay 0 problem

Post by Der_Kevin »

ah, thanks!
/usr/local/bin/convert -delay 2 -loop 0 -background Black -alpha Remove -layers Optimize "$@" ~/Desktop/animated.gif
helped, thanks!
got one last question regarding the output. how can i set the destination of the animated.gif. at the moment ist placed on my desktop, but would be nice if it would be at the same folder as the single frames are in
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert animated gif - delay 0 problem

Post by fmw42 »

either change directories to the input directory and leave off the path or add the same path to the output gif
Post Reply