Reputation: 1425
I want to write image to a file using rmagick. Given below is my code
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])
}
I have also tried to use f.write(image)
. But what get written in the file is #<Magick::Image:0x7eff0587f838>
. What is the reason for this?
Upvotes: 6
Views: 6747