Building ImageMagick 6.3.8 from source

Posted by John
on Sunday, 02 March 2008

Because Ubuntu 7.10 repositories don't have the latest version of ImageMagick, stopping you install the latest RMagick Ruby Gem; here's a guide to help you build it from source.

What had Gone Before

Before all this, I had installed the old version of ImageMagick by,

sudo apt-get install imagemagick
sudo apt-get install libmagick9-dev

So as you know before you start.

Remove ImageMagick

First off you're gonna have to remove your old copy of ImageMagick...

sudo apt-get remove imagemagick

Building & Installing ImageMagick 6.3.8

Now we're going to get the latest source files for ImageMagick and configure them correctly.

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.3.8-11.tar.gz
tar xvvzf ImageMagick-6.3.8-11.tar.gz
cd ImageMagick-6.3.8-11

Now we're in the source directory, G

./configure --prefix=/usr

Excellent, let's build...

sudo make

This will take a while, you may get a few warning pop up but hopefully no show-stoppers; afterwards lets install...

sudo make install

Rmagick Gem

And finally the latest RMagick Gem..

sudo gem install rmagick

If this still fails, you can install the old gem with..

sudo gem install rmagick -v=1.15.12

But fingers crossed let hope the new one works

Did it work?

Yes it all installed, and I've now got the RMagick 2.2.2 gem running on Ubuntu 7.10

So, What does it support?

Simple to find out, run the command below to see what version of ImageMagick you've got and what it can support.

identify -list format

Installing RMagick via MacPorts

Posted by John
on Sunday, 09 September 2007

Here's one especially for you Apple Mac lovers, how to easily install RMagick and all it's dependent libraries natively onto your Tiger OSX desktop.

Now if you begin to surf google you will notice at once people's glaring annoyance at how something so simple on Ubuntu is so difficult to get on OSX's Darwin O/S.

Thankfully with the help of "MacPorts":http://www.macports.org/ you can cut down the heartache and get back to developing apps.

Setting Up

So let's begin,

Before you do anything your going to have to setup your shell environment, so open up the Terminal and type:

ls -as

This lists all .dot files in your current directory, with this you should be able to see two system files called .bashlogin and .bashprofile, your going to need to edit these...

mate .bash_login
mate .bash_profile

Once you open these files (i use textmate to edit all my stuff and it offers a command-line addin so you can use it from the prompt, so it'll probably not work without this, just substitute 'mate' for vi, nano or whatever texteditor you have to hand).

Add these to the files...

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export DISPLAY=:0.0

Save your changes and close the files, now in the Terminal prompt type:

env

This will display what's in the mac's environment settings, your new additions should be in there.

Install MacPorts

Hard part over, all down-hill from here on in. Let's get started shall we,

Goto this link and download the latest mac binary .dmg file (install it like any other .dmg package, double-click it once downloaded to open it and then double-click the installer to install)

Afterwards you'll want to make sure you have the latest version, so open Terminal and type:

sudo port -d selfupdate

Yay!

Installing ImageMagick via MacPorts

This is brilliant, with MacPorts it allows you to automate the task of downloading, unpacking, configuring, making then finally installing each package's software so you can just get coding; major bonus!

So at the Terminal prompt run each of these one at a time...

sudo port install jpeg
sudo port install libpng
sudo port install libwmf
sudo port install freetype
sudo port install ghostscript

It'll take a while but afterwards you should have all of ImageMagick's dependencies built and installed (and more importantly all the latest ones!).

Next let's install ImageMagick,

sudo port install imagemagick

And Finally...

And finally lets install the RMagick gem,

sudo gem install rmagick

Excellent, you should now see in the prompt 'successfully install RMagick'

Now it's just up to you to use it, enjoy!

p.s. here's some links to some references if you get stuck...

Installing RMagick on Ubuntu

Posted by John
on Tuesday, 04 September 2007

Isn't open-source just wonderful, I mean with very little cash and a bit of time you can build something incredible just so long as your not afraid to roll up your sleeve's and delve into the console prompt; isn't much to ask is it?

Anyway today we'll go about quickly installing the RMagick Ruby gem to do some cool image manipulation and thumbnail management.

All examples are done on a development Ubuntu Server running 6.06 LTS, be sure to try this somewhere safe before hitting production ;-)

From start to end

Install imagemagick & Libs

First install imagemagick on Ubuntu...

sudo apt-get install imagemagick

Check it's installed...

dpkg -l | grep magick

Now install libmagick9-dev, making sure you choose the corresponding version for imagemagick IF asked (but you probably won't be)

sudo apt-get install libmagick9-dev

Gem Install

Now the easy bit (and most stressful), installing the Ruby Gem...

sudo gem install rmagick

After which you should see,

Building native extensions.
This could take a while...
Successfully installed rmagick-1.15.9

Doesn't Install !!!

Ok, for RMagick 2 it will only work for Imagemagick 6.3 and above, so to install the older version, do...

sudo gem install rmagick -v=1.15.10

Including it in your Ruby App

Now let's use it, by adding it to our controller/application_controller.rb

require 'RMagick'

Cool, your set to rock!

Useful Links