ImageMagick 6.4.x on CentOS 5

As is always the case with RedHat and CentOS, a number of packages in the usual yum repositories lack heavily behind the advancements made by their authors and teams. One such package is ImageMagick, which as of writing is back at 6.2.8 as opposed to 6.4.8. 

This for the most part isn’t an issue unless there is a specific upgrade, bug fix or enhancement you are looking to implement from within the ImageMagick library. In my case it was the use of the caret(^) character for specifying minimum geometric resize values. 

Unfortunately none of the yum repositories we regularly use have an updated package for 6.3.x or 6.4.x which left us in a bit of bind. We could either code our way around the issue (expensive, frustrating and time consuming) or seek another upgrade path. 

As no stranger to compiling packages from source I grabbed the latest tar.gz from the ImageMagick download page and proceeded to decompress it and compile. I then removed the yum installed package. Unfortunately at the end of this process, whilst the installation had succeeded I received strange error messages from the convert command line utility:

convert: no decode delegate for this image format `Book_icon.png' @ magick/constitute.c/ReadImage/526.
convert: missing an image filename `image.jpg' @ wand/convert.c/ConvertImageCommand/2710.

It turns out this is an easy enough problem to diagnose and resolve. The use of the following command provides an overview of the formats currently supported by our ImageMagick installation.

identify -list format

Well damn, no jpg support, no png, infact lots of things are missing. I guess we are missing some other rather important libraries prior to compilation. After installing the appropriate devel libraries via yum, we can configure again, make clean and install. Phew, thank god it works this time. 

yum remove ImageMagick
yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
wget url to ImageMagick download  
tar zxvf ImageMagick-6.4.8-3.tar.gz
configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
make clean
make
make install 

Too easy. Unfortunately you won’t get updates to your ImageMagick pushed from yum anymore, so keep the additional administration costs in mind, but for those requiring the latest versions this is the quick way to get setup and running.


 
 
 
  • Syed
    Thanks thanks thanks. I was having problem with ImageMagick and imagick for the last 3 weeks. Installation was OK and imagick was displaying in the phpinfo() but the functions were not available. Later I found out that in CentOS 5 default ImageMagick is 6.2.8, and to use imagick with all the features you need to upgrade ImageMagick to at least 6.3.1.

    Later found that you can't upgrade ImageMagick 6.2.8 by yum in CentOS 5. So, I had to build & compile it from source.

    Hope this info helps someone who desperately needed ImageMagick for his/her web project.

    Thanks again.
  • Joachim
    Thanks a million!
    This was very useful for me although I am on OpenSuse 10.1. But you pointed me in the right direction and saved my many hours of frustration, I am sure. My problem was that ImageMagick was not configured to support FreeType and the versions of both ImageMagick and Freetype were very old. This caused jpg-images from PDF:s to be broken with no text. Well, ImageMagick 6.6 works fine now with FreeType2!
  • Great blog entry! This just helped me successfully install ImageMagick 6.5 on CentOS 5.4.

    Thanks a bunch,
    Joakim
  • Hi Andrew,

    great blog entry! I just successfully installed ImageMagick 6.5.10 on CentOs 5.2.


    Thanks,
    Bob
  • Worked for me on CentOS 5.4 while trying to install RMagick 2.12.2
    First of all I installed default (read: obsolete) ImageMagick from yum to get all dependencies installed. Then I removed old ImageMagick and wget latest one, configured as adwised in this blogpost and installed.

    Finally, "gem install rmagick" - and, voila ;)
  • Daniele C.
    I have created a script to perform everything at once (note that it installs in /usr not /usr/local):

    #!/bin/sh
    wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz && \
    tar xfz ImageMagick.tar.gz && \
    rm ImageMagick.tar.gz && \
    cd ImageMagick* && \
    ./configure --prefix=/usr --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes && \
    make clean && \
    make && \
    sudo make install && \
    sudo ldconfig /usr/
  • Hector M
    Thanks for your solution, it save me a lot of time!.

    After installation I got the following error:

    convert: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory

    So I had to execute the following command so links will be updated:

    [user #]ldconfig /usr/

    I hope this help someone else.
  • SEO
    I get the following error when using your instructions on Cent OS:

    convert: error while loading shared libraries: libMagick.so.10: cannot open shared object file: No such file or directory
  • Becca
    I wish I had found this sooner, I ran through the regular instructions on the ImageMagick website :-\
  • Just in case anyone was wondering, the steps outlined above work with CentOS 4. I just upgraded my system to ImageMagick 6.5.0 using this.
  • marrk
    Thanks for this :)

    Couple of things I changed on my centos 5.3 machine, the configure line I used is :

    ./configure --prefix=/usr --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes

    Note the --prefix=/usr and the ./ before configure
  • Kannan
    Wow !!! That was an excellent note. Thank you veeeery much
  • god bless, i've been having an issue with imagemagick on cent 5 for the last couple of months and as i wasn't incredibly keen on fumbling my way through what you've so elegantly provided i've been blissfully and ignorantly ignoring the issue all together. i'll give this a shot on the weekend when i can schedule some down time on the server.
blog comments powered by Disqus