본문 바로가기

카테고리 없음

[rmagick] 설치및사용

1. sudo apt-get install libmagick9-dev

 http://stackoverflow.com/questions/5201689/rmagick-gem-install-cant-find-magick-config

2.  
sudo gem install rmagick

3. gemfile에 gem 'rmagick'

4. 쓰고자 하는 컨트롤러 상단에

require 'RMagick'

5. 쓸때는 아래와같이 

new_path = Rails.root.join("lib", "12.pdf").to_s
img = Magick::ImageList.new(new_path)
img.first.colorspace = Magick::RGBColorspace
thumb = img.first.resize_to_fit(100,100)
img.write('23.jpg')
thumb.write('thumb-rmagick.jpg')