Views:
18,317
Votes: 10
Tags:
command-line
imagemagick
image-processing
gif
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1027295
Title:
Is there a command to get the number of frames in a gif?
ID:
/2018/04/23/Is-there-a-command-to-get-the-number-of-frames-in-a-gif_
Created:
April 23, 2018
Edited: June 12, 2020
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
One-liner command
Inspired by this article, use this one-liner command:
$ identify drop_caches.gif | wc -l
128
For more details use:
identify -verbose filename.gif
This website lets you upload your .gif
and analyzes it many ways including the number of frames in it:
The convert
provided by Image Magic will convert your .gif
into individual .png
images one for each frame:
$ convert -verbose -coalesce drop_caches.gif drop_caches.png
drop_caches.gif[0] GIF 470x940 470x940+0+0 8-bit sRGB 256c 177KB 0.090u 0:00.099
drop_caches.gif[1] GIF 13x1 470x940+398+704 8-bit sRGB 256c 177KB 0.080u 0:00.089
drop_caches.gif[2] GIF 306x620 470x940+144+130 8-bit sRGB 256c 177KB 0.080u 0:00.089
(... SNIP ...)
drop_caches.gif=>drop_caches-125.png[125] GIF 470x940 470x940+0+0 8-bit sRGB 255c 50.3KB 27.100u 0:24.890
drop_caches.gif=>drop_caches-126.png[126] GIF 470x940 470x940+0+0 8-bit sRGB 254c 48.9KB 27.320u 0:25.089
drop_caches.gif=>drop_caches-127.png[127] GIF 470x940 470x940+0+0 8-bit sRGB 254c 48.9KB 27.480u 0:25.269