Compile ImageMagick from Source

# Make sure the following repos are enabled: RPMForge, Base

yum repolist

# Install Dependencies
yum –nogpgcheck install bzip2-devel freetype-devel libjpeg-devel libpng-devel libtiff-devel giflib-devel zlib-devel djvulibre-devel libwmf-devel libtool-ltdl-devel libX11-devel libXext-devel libXt-devel lcms2-devel libxml2-devel librsvg2-devel OpenEXR-devel perl-devel

# Install JP2 Library (Alternate)
cd ~/git
rm -rf installer_centos
git clone git://dev.entermediasoftware.com/installer_centos.git
cd installer_centos/installer/misc
sh install_libopenjp2.sh
ldconfig

# Validate JP2 Library
pkg-config –exists –print-errors “libopenjp2 >= 2.1.0″

# Upgrade LCMS library
yum install lcms2

# Shutdown Tomcat
service tomcat stop

# Remove Old ImageMagick
cd ~/git/installer_centos/installer/rpms/
rpm -e ImageMagick-6.7*
whereis convert

# Build and Install ImageMagick
mkdir ~/imagemagickupgrade
cd ~/imagemagickupgrade
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-6*
./configure –prefix=”/usr” –with-openjp2 –with-wmf –with-rsvg –with-gslib –with-x
make
sudo make install
sudo ldconfig /usr/local/lib
convert -version

# Modify delegates.xml
vi /usr/etc/ImageMagick-6/delegates.xml
Add “-dUseCIEColor” to ps:cmyk line after -dBATCH

Building an ImageMagick RPM

# Install the latest ImageMagick SRC RPM

wget http://www.imagemagick.org/download/linux/SRPMS/ImageMagick-6.8.9-1.src.rpm

rpm -ivh ImageMagick-6.8.9-1.src.rpm

# Install dependencies
yum install rpm-build rpmlib bzip2-devel freetype-devel libjpeg-devel libpng-devel libtiff-devel giflib-devel zlib-devel djvulibre-devel libwmf-devel libtool-ltdl-devel libX11-devel libXext-devel libXt-devel lcms-devel lcms2-devel libxml2-devel librsvg2-devel OpenEXR-devel perl-devel

yum groupinstall “Development Tools”

#Install webp-lib

Download the latest remi-release rpm from  http://rpms.famillecollet.com/enterprise/6/remi/i386/

Install remi-release rpm:

# rpm -Uvh remi-release*rpm

Install libwebp-devel rpm package:

# yum –enablerepo=remi install libwebp-devel

#Configure ImageMagick Spec
vi ~/rpmbuild/SPECS/ImageMagick.spec

%configure –prefix=/usr \
–enable-shared \
–disable-static \
–with-modules \
–with-perl \
–with-x \
–with-threads \
–with-magick_plus_plus \
–with-gslib \
–with-wmf \
–with-lcms \
–with-rsvg \
–with-xml \
–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 \
–with-perl-options=”INSTALLDIRS=vendor %{?perl_prefix} CC=’%__cc -L$PWD/magick/.libs’ LDDLFLAGS=’-shared -L$PWD/magick/.libs'” \
–without-dps

# Build all
rpmbuild -bb ~/rpmbuild/SPECS/ImageMagick.spec