星期二, 7月 17, 2007

Installing RMagick on Ubuntu

Before install RMagick, we need to install ImageMagick and the delegate libraries used by ImageMagick.

Here are some recommended delegate libraries:

  • FreeType, Version 2.0 or above, to annotate with TrueType and Poscript Type 1 fonts.
  • libjpeg to read and write JPEG v1 format images.
  • The PNG library, to read and write PNG format images.
  • libwmf 0.2.5 or later, to read and write Windows Meta File (WMF) format images.
  • Ghostscript version 8.10, to read and write the PDF and PS document formats.
For the default Ubuntu 7.0.4 installation, I have to install FreeType v2 from a tarball. For the libjpeg, libpng, and libwmf, the runtime library are installed, so I just need to install the development library. Since I am too lazy, I just install those thru Synaptic Package Manager.

For the ghostscript, remember to install fonts into /usr/share/ghostscript; otherwise RMagick will complain during compilation.

Step 1: Install ImageMagick

Go to http://www.imagemagick.org and download the latest version of the software to a temporary directory.
tar xvzf ImageMagick.tar.gz
cd ImageMagick-X.Y.Z
Then configure ImageMagick
./configure --disable-static --with-modules --without-perl \
--without-magick-plus-plus --with-quantum-depth=8
Once you have configured ImageMagick the way you want it, enter these two commands:
make install
sudo make install

Step 2: Install RMagick

Issue the command

sudo gem install rmagick
You will see this output:
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions. This could take a while...
Successfully installed rmagick-1.15.7

Be patient. A lot of time will pass with no output from the gem command. The "Successfully installed" message does not mean that RMagick was successfully installed. The RMagick installation can encounter error conditions that gem can't detect. The following irb session is a better indicator of a successful install.

$ irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version
This is RMagick 1.15.7 ($Date: 2007/06/09 16:45:25 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.5 07/17/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
=> nil

The RMagick HTML documentation is automatically installed at
/usr/local/share/RMagick/index.html.


Done!!!

沒有留言: