rmagick is there a way to convert image in memory

二次信任 提交于 2019-12-01 16:56:54
Dan Grahn
# assuming you have an image
# img = Magick::Image.new( 100, 100 )
img = Magick::Image.from_blob( img.to_blob { self.format = "png" } )

Source: RMagick Docs

Here's an example on how to give it to the user

image.format = "png"
send_data image.to_blob,
    :filename => "woohoo.png",
    :disposition => 'inline',
    :quality => 90,
    :type => 'image/png'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!