Somehow my prior install of ImageMagick, a custom build from source, lacked proper PNG support. A bit of searching uncovered this excellent guide to installing it from a source RPM – but I had a few modifications to those instructions so decided to record my own.
Firstly, I had to uninstall my custom build, so off to the build directory (you should always keep these) to run sudo make uninstall
. Or check for any old rpm installs: rpm -qa | grep ImageMagick
.
Next, upgrading packages. Some I had, some I didn’t. You’ll need EPEL.
yum --enablerepo=epel --enablerepo=rpmforge install djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel librsvg2-devel openexr-devel gcc gcc-c++ ghostscript freetype-devel libjpeg-devel libpng-devel giflib-devel libwmf-devel libexif-devel libtiff-devel
Note there are several deletions from the post I referenced above; I had some dependency conflicts and I removed them.
Next, download this source RPM:
wget http://red.penguin.ro/SRPMS/ImageMagick-6.5.7-0.src.rpm
And build it:
rpmbuild --rebuild ImageMagick-6.5.7-0.src.rpm
Hopefully it will work first time; did for me.
Now you should be able to run:
$ rpm -Uvh /usr/src/redhat/RPMS/x86_64/ImageMagick-6.5.7-0.x86_64.rpm $ rpm -Uvh /usr/src/redhat/RPMS/x86_64/ImageMagick-devel-6.5.7-0.x86_64.rpm
I skipped all the others since I don’t need them but you might want to add the C++, perl, etc libraries too.
Confirm you’ve got the correct version in your path:
$ convert --version Version: ImageMagick 6.5.7-0 2009-11-12 Q16 OpenMP http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
And now reinstall rmagick:
sudo gem install rmagick
And we’re done!
Tags: imagemagick, rhel5