Setting Up ImageMagick

From Helioviewer Wiki

Jump to: navigation, search

Contents

Linux Setup

The package names here are specifically for Ubuntu 10.04, but Fedora will have similar if not identical package names.

Install ImageMagick

Note: There are several ways to install ImageMagick, and you may need to try more than one.

Install ImageMagick from the Ubuntu repositories

 sudo apt-get install imagemagick

To make sure this worked properly, use the command

 identify -version

and look for the version number. If it is not "6.3.7" or lower, you may have trouble with .png conversions. In this case, to make sure yours works, find a jpeg or gif image, and do

 convert x.jpg y.png
 identify y.png

and make sure that the file type of y.png is actually PNG and not something else. If it is something else, you will need to remove imagemagick (sudo apt-get remove imagemagick) and install another way.

Install ImageMagick from a different Ubuntu repository

If you are running 9.04 (Jaunty), the package for ImageMagick does not configure correctly sometimes, so you can try getting the package from the 8.10 (Hardy) repository instead. Go to

 http://packages.ubuntu.com/hardy/imagemagick

and download the .tar.gz package from that page. Follow the instructions below for compiling from source.

Compile and Install ImageMagick from source

In order to compile ImageMagick from source, or use the latest version of the PHP module IMagick, you must first install the MagicWand devleopment headers:

 sudo apt-get install libmagickwand-dev

Alternatively, you may also use apt-get's built-in "build-dep" function to install the dependencies needed to compile ImageMagick. The only different is that build-dep may download extra libraries used for auxillary functionality which we won't necessarily need:

sudo apt-get build-dep imagemagick

You may either get the 8.10 (Hardy)-specific package from the page listed above, or you can download the .tar.gz package from http://imagemagick.org/script/install-source.php. Type the following commands:

 tar xzvf ImageMagick-6.x.x.x.tar.gz
 cd ImageMagic-6.x.x.x/
 ./configure

Once it is done configuring, the program will print out all configuration options. Watch for a label with "PNG" in it, and make sure that the far right column has "YES" in it. If it does not, you will need to find an earlier package such as version 6.3.7.x and try again.

Once you are sure it is configured correctly, do

 sudo make
 sudo make install

And you should be all set up. Do a convert x.jpg y.png to be sure.

Install imagick extension for PHP

Once again, there are two different ways to install it. Installing with pecl will ensure that all imagick functions work, as the version in the repository is out of date and several alpha-masking functions do not work with it.

Install with pecl (Recommended)

 sudo apt-get install php5-dev php-pear libmagickwand-dev
 sudo pecl install imagick

You should not need to do anything further except perhaps to restart your web server:

 sudo /etc/init.d/apache2 restart

Install from repository

 sudo apt-get install php5-imagick

Once again, restart your webserver:

 sudo /etc/init.d/apache2 restart

Done!!

Troubleshooting

If you receive an error message about not finding "imagick.so.10", you need to edit your LD_LIBRARY_PATH:

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib

If this still does not work and you have installed imagick with pecl, try installing it again from the repository.

"Error: no decode delegate for this image format." You need to install the proper delegate for the file format. To find out what "delegates" are installed, do

 convert -list configure

and look for "DELEGATES". Next to it will be listed all of the file extensions ImageMagick is configured to use. If yours is not listed there (for example, if jpeg is missing and you need jpeg), you can download the delegate from http://www.imagemagick.org/download/delegates/. Download the .tar.gz version of the delegate you need. In this example I will use "tiff-3.8.2".

 tar xzvf tiff-3.8.2.tar.gz
 cd tiff-3.8.2/
 ./configure
 sudo make
 sudo make install
 make clean

This will install the delegate for ImageMagick. If it is still not functioning properly, you may need to locate the directory with the source code for ImageMagick (if you compiled it from source) and type

 ./configure
 sudo make
 sudo make install

to reconfigure it.

buy lasix online
Personal tools