开发者

RMagick error with animated gif

开发者 https://www.devze.com 2023-03-19 00:17 出处:网络
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 ().

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 (

RMagick error with animated 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消