I have installed the ImageMagick extension for PHP on CentOS, but it does not have support for PNG or JPG, how do I add support for these file types to ImageMagick?

  • 2
    What is the output of identify -list format – Prix Aug 14 '10 at 0:02
  • I don't understand why it wouldn't have support for those unless it was compiled that way for a specific purpose. Are you sure you have the right package? – Dennis Williamson Aug 14 '10 at 0:49
  • Dennis in some cases (i.e.: using yum) it may not install a program with all it is features, resulting in the need of compiling or using an alternative source. – Prix Aug 14 '10 at 1:40
  • 1
    Prix: that's an incomplete statement. It's not that using yum is doing it wrong, which this seems to imply. It's true in some cases, functionality is provided by a sub-package not pulled in by dependencies by default, or that for stability or legal reasons the package wasn't build with all features. But none of those things apply to ImageMagick's PNG and JPG support in CentOS. – mattdm Nov 16 '10 at 15:09

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
  • We have done this with no success – Unkwntech Aug 19 '10 at 21:43
  • after you have done this what was the output of identify -list format did any error occur during the proccess ? – Prix Aug 20 '10 at 3:15

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 install 

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.


ehm, just in case, do you have an x86_64 CentOS system ? you install the *-devel for x86_64 ? i386 ? do you ref to the correct header/libs in the build for x86_64 if you have and x86_64 system ?


Centos has a binary release. I suggest you should go with that.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.