ImageMagick Installation

From TechWiki

Jump to: navigation, search

Contents

What is ImageMagick

ImageMagick is an open source software suite for displaying, converting, and editing raster image files. It can read and write over 100 image file formats. ImageMagick is licensed under the ImageMagick License, a BSD-style license.

ImageMagick
ImageMagick

Why use ImageMagick

ImageMagick is an extremely powerful tool when manipulating images from the command line. Not only does the tool allow for the manipuilation of images through the command line it also provides extensive libraries and [APIs|API] to access its functionality through other programs.

The most popular use of ImageMagick is to create thumbnails. However the scope of usage goes much further.

ImageMagic also comes with an inbuilt and integrated perl API. The Perl API is detailed below.

Preparing for the Install

NOTE: The following details the installation of ImageMagick on Ubuntu LTS 8.04, it should however work on other Unix like systems.

The ImageMagick installation tends to be fairly painful due to the verity of modules that it is dependent on. Unfortunately the Ubuntu packages do not install either.

Here is a list of the various packages that you will be using:

  1. libperl-dev - Perl library: development files Ubuntu Package Location
  2. freeType Ubuntu Package Location
  3. libpng Ubuntu Package Location
  4. libjpeg62-dev Ubuntu Package Location If that does not work you can try [1]
  5. libtiff4-dev Ubuntu Package Location
  6. ghostscript Ubuntu Package Location

Once you have installed all of these packages (either by downloading the packages for your appropriate OS or by using your install tools such as YUM and apt-get you are ready to install ImageMagick.

Installing ImageMagick

Unfortunately, before going ahead with the installation, we need to decide on what we want and install some prerequisites.

Deciding on what you want

At this point you need to choose between having a multi-thread enabled ImageMagic through OpenMP or PerlMagic. PerlMagick is the ImageMagick API that allows you to use ImageMagick functionality through Perl.

Getting and unpacking ImageMagick

This section details the downloading and extraction of ImageMagic. If you know how to do this you can simply pick up the download link from here and jump ahead.

Download ImageMagick by going to the link provided, clicking on download and selecting a mirror. Ignore what a mirror is if you are unsure, simply pick a url and download.

Once you download the package, it is likely to be compressed. Uncompress it and traverse to the uncompressed package directory from your terminal.

configure; make; make install

Now depending on whether you have chosen perl or openMP type in the following commands.


## If you don't care about PerlMagick
./configure 

## If you do want PerlMagick
./configure --disable-openmp
## Or even better
./configure --disable-openmp --with-perl
## Then in all cases
make
sudo make install 

If you do not use the --disable-openmp option and try running PerlMagick you are likely to get an ugly error that looks something like:

Can't load '/usr/local/lib/perl/5.8.8/auto/Image/Magick/Magick.so'
 for module Image::Magick: libgomp.so.1: 
 shared object cannot be dlopen()ed at 
 /usr/lib/perl/5.8/DynaLoader.pm line 225.
          at -e line 1

## Followed by a bunch of more errors.


And thats it, you should have ImageMagick up and running.

Common errors

No decode delegate for this image format

Once you have installed ImageMagick it will fail to deal with certain file formates if you failed to install these prerequisites before installing ImageMagic (or of ImageMagick did not detect these prerequisites)

You can find a list of delegates on the ImageMagick Delegates list section. Download and install what you require.

Once you are done with this re-run configure, make and make install.

The Delegate configuration section of the configure output will tell you what ImageMagick is going to work with and will look something like this:


Delegate Configuration:
BZLIB             --with-bzlib=yes		no
Autotrace         --with-autotrace=no		no
DJVU              --with-djvu=yes		no
DPS               --with-dps=yes		no
FlashPIX          --with-fpx=yes		yes
FontConfig        --with-fontconfig=no		no
FreeType          --with-freetype=yes		yes
GhostPCL          None				pcl6 (unknown)
GhostXPS          None				gxps (unknown)
Ghostscript       None				gs (8.15)
Ghostscript fonts --with-gs-font-dir=default	/usr/share/fonts/type1/gsfonts/
Ghostscript lib   --with-gslib=no		no
Graphviz          --with-gvc=yes		no
JBIG              --with-jbig=yes		no
JPEG v1           --with-jpeg=yes		yes
JPEG-2000         --with-jp2=yes		no
LCMS              --with-lcms=yes		no
LQR               --with-lqr=yes		no
Magick++          --with-magick-plus-plus=yes	yes
OpenEXR           --with-openexr=yes		no
PERL              --with-perl=yes		/usr/bin/perl
PNG               --with-png=yes		yes
RSVG              --with-rsvg=no		no
TIFF              --with-tiff=yes		yes
Windows fonts     --with-windows-font-dir=	none
WMF               --with-wmf=yes		no
X11               --with-x=			no
XML               --with-xml=no		no
ZLIB              --with-zlib=yes		yes



NOTE:


ZLIB              --with-zlib=yes		yes

The zlib and bzlib libraries sometimes give errors 
The --without-zlib sometimes does not work. 
     One option is to edit the configure.in file; 
     The other is to simply remove zlib (Do this at your own risk!!)

Installing on Remote Servers

When attempting to install ImageMagick on remote servers by use of ssh, be warned, its likely to take a while and if your connection keeps resetting it can be a pain.

You might want to read a little on how to get around this and other such remote servers issues on the Working on Remote Servers Page

Personal tools