Adding PNG & JPG support to ImageMagick in PHP on CentOS

Solution 1:

You would possible need to compile it from the source with the options to what you have misssing:

  1. yum remove ImageMagick
  2. yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel
  3. wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.3-5.tar.gz
  4. tar zxvf ImageMagick-6.6.3-5.tar.gz
  5. cd ImageMagick-6.6.3-5
  6. ./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
  7. make clean
  8. make
  9. make install

Solution 2:

Always you face a problem related to the system thing, give details about your enviroment: version of packages, version of linux distribution, etc. That said, it is known that ImageMagick 6.4.x on CentOS 5 give problems with formats you explained.

You get a bunch of details on this post of Andrew Duck:

ImageMagick 6.4.x on CentOS 5

He got solution removing ImageMagick package, and compiling the source plus related stuff:

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 

Solution 3:

Which ImageMagick extension for PHP on CentOS did you install, and how did you do it? As far as I'm aware, there isn't such an extension in base CentOS 5.x. Did you use the php-pecl-imagick package from EPEL? That should already be built with PNG and JPEG support.