nnm*_*nnm 6 ruby ruby-on-rails rmagick image-processing
我想使用rmagick将图像写入文件.以下是我的代码
im = "base64encodedstring"
image = Magick::Image.from_blob(Base64.decode64(im)
image[0].format = "jpeg"
name ="something_temp"
path = "/somepath/" + name
File.open(path, "wb") { |f|
f.write(image[0])
}
Run Code Online (Sandbox Code Playgroud)
我也试过用f.write(image).但是在文件中写的是#<Magick::Image:0x7eff0587f838>.这是什么原因?