Ruby image manipulation

Hey everyone,

Just curious if anyone has had any luck installing
ImageMagick-6.7.4-Q16
and rmagick-2.13.x. I have been trying to follow a few posts out here,
but
no luck. I can obviously get ImageMagick in stalled, but when I try to
install the gem rmagick(gem install rmagick) It’s like it’s trying to
build
the gem.

I have several ruby applications(back end) that use a XML file to get
the
offsets in the binary file, then extract that data, and build a image.
Files have to be converted to tiff and jpg, and other operations like
image
resizing, etc… I am about to play around with Dragonfly so I was
curious
how people liked it.

sorry… I’m on Ruby 1.9.2 and Rubygems that comes in that bundle, I
think
that’s 1.7.2

On Tue, Jan 10, 2012 at 7:55 AM, Daniel S.
<[email protected]

On Tue, Jan 10, 2012 at 2:55 PM, Daniel S.
<[email protected]

wrote:

Hey everyone,

Just curious if anyone has had any luck installing ImageMagick-6.7.4-Q16
and rmagick-2.13.x. I have been trying to follow a few posts out here, but
no luck. I can obviously get ImageMagick in stalled, but when I try to
install the gem rmagick(gem install rmagick) It’s like it’s trying to build
the gem.

TL;DR : $ sudo apt-get install libmagickcore-dev libmagickwand-dev
**
Yes, it is trying to build “native extensions”.

Assuming you saw this error:

~/data/projects/temp/rmagick$ bundle install Fetching source index for http://rubygems.org/ Installing rmagick (2.13.1) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    /home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb

checking for Ruby version >= 1.8.5… yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for gcc… yes
checking for Magick-config… no
Can’t install RMagick 2.13.1. Can’t find Magick-config in
/home/peterv/.rvm/gems/ruby-1.9.3-p0@rmagick
/bin:/home/peterv/.rvm/gems/ruby-1.9.3-p0@global
/bin:/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin:/home/peterv/.rvm/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

Gem files will remain installed in
/home/peterv/.rvm/gems/ruby-1.9.3-p0@rmagick/gems/rmagick-2.13.1 for
inspection.
Results logged to /home/peterv/.rvm/gems/ruby-1.9.3-p0@rmagick
/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot
continue.
Make sure that gem install rmagick -v '2.13.1' succeeds before
bundling.

I used the regular trick to find the required debian/Ubuntu packages:

~/data/projects/temp/rmagick$ apt-cache search magick | grep ‘-dev’
libmagick+±dev - object-oriented C++ interface to ImageMagick -
development files
libmagickcore-dev - low-level image manipulation library - development
files
libmagickwand-dev - image manipulation library - development files
graphicsmagick-libmagick-dev-compat - image processing libraries
providing
ImageMagick interface
libgraphicsmagick++1-dev - format-independent image processing - C++
development files
libgraphicsmagick1-dev - format-independent image processing - C
development files
libvips-dev - image processing system good for very large images (dev)

Installed
~/data/projects/temp/rmagick$ sudo apt-get install libmagickcore-dev

this pulls in 80+ packages … probably a smaller set would suffice …

~/data/projects/temp/rmagick$ sudo apt-get install libmagickwand-dev

this was only 1 package

And now gem install or bundle install works:

~/data/projects/temp/rmagick$ bundle install
Fetching source index for http://rubygems.org/
Installing rmagick (2.13.1) with native extensions
Using bundler (1.0.21)

HTH,

Peter