在ubuntu上安装rmagick

在ubuntu上安装rmagick

$ sudo apt-get install imagemagick
$ sudo gem install rmagick --include-dependencies

出现“configure: error: Can't install RMagick. Can't find Magick-config or GraphicsMagick-config program.” 错误。按提示安装以下包:
$ sudo apt-get install libmagick9-dev || sudo apt-get install libmagickwand-dev

再次安装gem:
$ sudo gem install rmagick --include-dependencies

重启Rails服务,RMagic安装成功。

require 'rubygems'
require 'RMagick'

img = Magick::Image.read(’logo.jpg’).first
width,height = 50,50
thumb = img.resize(width,height)
thumb.write(’my1.jpg’)

 

 

jd.com  ### export GIT_SSL_NO_VERIFY=1

你可能感兴趣的:(RMagick)