开发者

How to convert an image string into a stream in Ruby

I use Ruby Gem curb to fetch image by the method of body_str of Curl::Easy instance, then want to use RMagick to process the image开发者_JAVA百科, however Magick::Image.read needs a file name to read, but what i get is the content string of the image. Yes, i know i can firstly convert the image content string into a file, then pass the file name to Magick::Image.read method. But that will add one more IO operation.

So i want to know whether it's possible to convert an image content string into stream directly, so that i can use RMagick to read it directly.

Thank you in advance.


Check other class methods of Image class, particularly from_blob. Sounds like what you need.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜