How to tell if GIF is animated?

左心房为你撑大大i 提交于 2019-12-10 22:28:04

问题


I have this Rails app with Paperclip for image uploads -- but how do I check if the image is an animated GIF with RMagick?


回答1:


You can count the scenes associated with the image. In Rmagick that means doing 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


来源:https://stackoverflow.com/questions/27238816/how-to-tell-if-gif-is-animated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!