I am using Imagemagick to turn a gif into a corresponding series of jpgs and I am trying to determine when each jpg happens in a series.
stolen from How do I detect an animated GIF's ticks per second?: identify -format "%T ticks: %f: Frame[%s] %m %wx%h %P%O %r %z-bit\n" tree.gif
4 ticks: tree.gif: Frame[0] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks: tree.gif: Frame[1] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks: tree.gif: Frame[2] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks: tree.gif: Frame[3] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks: tree.gif: Frame[4] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
4 ticks: tree.gif: Frame[5] GIF 247x175 247x175+0+0 PseudoClassRGBMatte 8-bit
and identify tree.gif gives me
tree.gif[0] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[1] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[2] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[3] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.000
tree.gif[4] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
tree.gif[5] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
tree.gif[6] GIF 247x175 247x175+0+0 8-bit PseudoClass 256c 1.923MB 0.000u 0:00.010
...
can anyone translate this output that will tell me either the framerate or when each frame appears? Extra points if you can make it work using RMagick.
There are complications. First of all, you need to use the %T and %s escapes to look at the frame number and the delay (in centiseconds), not the vanilla identify command. Second, the delay from one frame to the next varies, so you need to be prepared to deal with cases when your animated GIF does not have a unified "frame rate" from end to end.
Here is an example command: identify -format "Frame %s: %Tcs\n" A.gif
For more info:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With