如何判断GIF是否动画?
我有这个带有Paperclip的Rails应用程序用于图像上传 – 但是如何检查图像是否是带有RMagick的动画GIF?
您可以计算与图像相关的scenes
。 在Rmagick
中意味着做这样的事情:
image = Magick::ImageList.new(image_file) if image.scene == 0 #this is not an animated gif else #this is an animated gif end
我有这个带有Paperclip的Rails应用程序用于图像上传 – 但是如何检查图像是否是带有RMagick的动画GIF?
您可以计算与图像相关的scenes
。 在Rmagick
中意味着做这样的事情:
image = Magick::ImageList.new(image_file) if image.scene == 0 #this is not an animated gif else #this is an animated gif end