I have encountered ImageMagickError when using RMagick to read a animated GIF of http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/20.gif (
).require 'open-uri'
require 'rmagick'
url = 'http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/20.gif'
Magick::Image.from_blob(open(url).read)
It gives an error message like "in from_blob : corrupt image @ error/gif.c/ReadGIFImage/1331 (Magick::ImageMagickError)
".
I have read the document ( htt开发者_运维问答p://www.imagemagick.org/RMagick/doc/image1.html#from_blob ) and it says from_blob
can handle an animated GIF.
The code works with many images but this one. Anyone RMagick user have some idea about the error?
You have to use simply Magick::Image.read(url)
精彩评论