4

Currently we use a stopwatch to determine the Total duration of Animation on the gif banners.

Already referred to the imagemagick solutions - How to determine the length of a .gif animation in milliseconds

Sample gif banner: http://i.stack.imgur.com/JTz79.gif


Actual Stats:-

Iterations = 20

Duration - Frame 1 = 0.5 secs

Duration - Frame 2 = 0.5 secs

Total Time = 20*(0.5+0.5) = 20 secs


Stats provided by ImageMagick:-

Using - identify -verbose betsy.gif | grep -E 'Iterations|Elapsed'

Iterations: 19

Elapsed time: 0:01.000

Elapsed time: 0:01.040

Total Time = 1.040*19 = 19.76 secs


Is there any other way (except for using a physical stopwatch) to find the exact Duration of the Animation programmatically?

Community
  • 1
  • 1
Betsy Joy
  • 41
  • 1
  • 3
  • 1
    I think you have an old version if ImageMagick. I use v6.9.3 and it correctly reports 1 second for your file. Try also `identify -format '%T\n' betsy.gif` for individual frame lengths in centiseconds. – Mark Setchell Jan 26 '16 at 09:55

1 Answers1

2

Use exiftool like:

$ exiftool splash.gif 
ExifTool Version Number         : 11.76
File Name                       : splash.gif
Directory                       : .
File Size                       : 1062 kB
File Modification Date/Time     : 2020:06:18 10:04:16+02:00
File Access Date/Time           : 2020:06:18 09:51:54+02:00
File Inode Change Date/Time     : 2020:06:18 10:04:16+02:00
File Permissions                : rw-r--r--
File Type                       : GIF
File Type Extension             : gif
MIME Type                       : image/gif
GIF Version                     : 89a
Image Width                     : 950
Image Height                    : 140
Has Color Map                   : Yes
Color Resolution Depth          : 1
Bits Per Pixel                  : 1
Background Color                : 0
Animation Iterations            : Infinite
Frame Count                     : 149
Duration                        : 4.96 s
Image Size                      : 950x140
Megapixels                      : 0.133

You can find Duration in seconds.

Daniel Walter
  • 775
  • 5
  • 12
  • For reference: I tested with Exiftool 10.80 and it gets the duration incorrect. I'll try again when I have a later version. – Ken Sharp Jul 25 '20 at 12:42