gif 动画的总持续时间

Bet*_*Joy 5 animation imagemagick gif animated-gif

目前,我们使用秒表来确定 gif 横幅上动画的总持续时间。

已经参考了 imagemagick 解决方案 -如何确定 .gif 动画的长度(以毫秒为单位)

示例 gif 横幅: https://i.stack.imgur.com/JTz79.gif


实际统计数据:-

迭代次数 = 20

持续时间 - 帧 1 = 0.5 秒

持续时间 - 第 2 帧 = 0.5 秒

总时间 = 20*(0.5+0.5) = 20 秒


ImageMagick 提供的统计数据:-

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

迭代次数:19

经过时间:0:01.000

经过时间:0:01.040

总时间 = 1.040*19 = 19.76 秒


有没有其他方法(除了使用物理秒表)以编程方式找到动画的确切持续时间?

Dan*_*ter 4

使用 exiftool 例如:

$ 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
Run Code Online (Sandbox Code Playgroud)

您可以找到以秒为单位的持续时间。