How do I know if a GIF is animated?

I have this Rails app with a folder to load images - but how can I check if an image is an animated GIF using RMagick?

+3


source to share


1 answer


You can count scenes

associated with the image. The Rmagick

means to do something like this:



image = Magick::ImageList.new(image_file)

if image.scene == 0
  #this is not an animated gif
else
  #this is an animated gif
end

      

+3


source







All Articles