bevanb
bevanb

Reputation: 8521

Is this GIF a still image or an animation? (in Ruby)

How can I use rmagick to determine how many frames a remote GIF has?

Upvotes: 0

Views: 302

Answers (1)

Stefan
Stefan

Reputation: 114158

You can use Magick::ImageList#length:

Returns the number of images in the imagelist.

For example, this remote GIF:

has 12 frames:

require 'rmagick'
Magick::ImageList.new('https://i.giphy.com/zlLydol7ndM7C.gif').length
#=> 12

Upvotes: 3

Related Questions