convert -delay AND FPS in animated GIF

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
xioni

convert -delay AND FPS in animated GIF

Post by xioni »

hopefully an easy question. i am using convert -delay to create animated GIFs from individual images with different frame rates. i didn't understand the ticks/time explanation in the description of the flags on page

LINK: command line options: convert -delay

for example, i used convert -delay 8. when i open the resultant animated GIF in QuickTime, it indicates that the rate is 12.5 FPS (frames per second).

if i choose convert -delay N is the equation to determine frame rate from N and vice versa

100/N = FPS

or is it more subtle than this?

thanks for any input
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -delay AND FPS in animated GIF

Post by fmw42 »

As I understand it, the (IM default) ticks are 1/100 of a second, i.e. 100 ticks per second. (But the ticks value can be changed). So a delay of 8 would be 8/100 of a second between frames. This makes the frame rate (FPS) = 1/(delay in seconds) = 100/(delay in ticks). So for IM delay of 8, you would get a FPS=100/8=12.5

Note however, that some browsers enforce a minimum delay (that may be different with each browser). Thus any delay shorter than that minimum will be set to that minimum, so that you cannot change frames too fast (faster than the browser can keep up).

If someone knows the precise minimum delays for any given browser, perhaps they can add to this discussion.
xioni

Re: convert -delay AND FPS in animated GIF

Post by xioni »

many thanks for clarifying.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert -delay AND FPS in animated GIF

Post by anthony »

You can specify a different tick rate fro example 8/1 would be 8 seconds
or 8 1 second ticks while 8/2 would be 8 half second ticks ot 4 second.

The default is 100 'ticks' per second or N/100 as this is the default used by GIF animations. As such 8 on its own is equivelent to a 8/100 second delay

NOTE internet explorer has a minimum speed of 6. And no browser honors a 0 delay as meaning (so fast don't even bother to display) which is typically used as a GIF animation frame optimization method.

See Zero Delay Frames
http://www.imagemagick.org/Usage/anim_basics/#zero
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply