Friday, February 1

Installing and configuring ImageMagick with WAMP on windows 7.

Installing and configuring ImageMagick with WAMP on windows 7.

Image Magick is a software suit to create, edit, compose or convert bitmap images. It support a wide range of image formats. You can also use image magick to resize, rotate, flop, mirror etc images. You can use the functionality of image magick from command line or you can use it via your favorite programming language.


Php has an ImageMagick class which uses the image magick api. With this class you get various methods with which you can create a web app to execute various functionalities such as image conversion from one format to another etc. you can check the imagick manual here.


Requirements

I previously had an experience in installing the image magick suit and the corresponding php dll api on windows xp.


I had xampp 1.7 verison installed and image magick version 6.6. To get xampp working with image magic api, the php dll extension used was compiled using vc6(Visual studio 6). (Pretty old version, and it required a lot of trial and error in configuring the correct versions)


Now I had to install image magick on the latest windows 7 machine. Following was the configuration of the stystem.


1) OS – windows 7 Enterprise Edition service pack 1
2) System Type – 64-bit Operating System

Step 1


Installing wamp server


This time I wanted to go with wamp server instead of xampp server. There is a 32 bit as well as a 64 bit wamp server available for download. See their website

Initially I installed a 64bit wamp server setup but was not able to get image magick running. Also I read in one of the stackoverflow forum that image magick dll for 64 bit does not work. (No evidence or any solid statment) So I then downgraded to installing a 32 bit wamp server setup. Make sure you install Visual C++ 2010 SP1 Redistributable Package x86 or x64 as mentioned in the wamp website. See below screenshot.




Step 2

Check if wamp is installed correctly.

After installing wamp, for me the wamp server would not start and apache services would not install for me. When you right click wamp system tray icon and go to apache->services and click on Test port 80, it would say that


port 80 is used by Microsoft HTTPAPI/2.0. To install the service, we first need to release port 80.


There are various resources available which provide the solution. Some of the possibilities could be IIS server installed, Skype installed etc. If skype is installed and running. Either stop skype and then start wamp server, and then start skype or change the port in skype settings to not use port 80.


(Below screenshot is taken just to show where you can get the option to Test port)





I tried with disabling IIS, removing port 80 option in skype but it did not work. Then I changed the port to which apache listens to in httpd.conf file to port 7080 instead of port 80. And then my wamp setup work.


http://localhost:7080



Step 3


Installing Image Magick software.


To be able to use the image Magick API in your program, you have to install the image magick software. There are various binaries of image magick available. You can learn about the latest version here. http://www.imagemagick.org/script/binary-releases.php


However we require the binaries for which there is a compiled php dll available. Since wamp server uses the php version 5.3.12 (in my case). I was looking for an image magick binary which has a php dll available.


You can download the latest php builds for image magick here . However we also need the Image Magick binary. You can get the older binaries from here .


It has a lot if binaries available for download. After trial and error multiple windows restart, it turns out the best binary suitable which worked with the dll file was ImageMagick-6.8.0-0-Q16-windows-dll.exe.





Once you have Image Magick installed, check if it is working correctly. Go To command prompt and type


convert -version




Step 4


Configuring php dll file with wamp


Now that Image Magick is installed and you have the php dll file downloaded from the website, you can now save this dll file in your php ext folder. For me it was in

C:\wamp\bin\php\php5.3.13\ext




Update your php.ini file


extension=php_imagick.dll


Restart your system. Then start your wamp server. Once everything looks fine, check your phpinfo() for imagick installation.



Everything looks pretty good :) Go over to your project and start coding

Hope this helps someone. If you have any experience in Image Magick, or know about such tool, or you have any comments, share here

Be the first one to Comment!!!

  1. Finally , it Works!!! Thank you ! i've been surfing a lot of webpages with no luck.

    ReplyDelete
    Replies
    1. hello anonymous....
      plz tell me that where the all dll of remaining with imagmagik.dll should be put...

      Delete
    2. Where is the dll???

      Delete
  2. Not so far I have found new cool tool to work on win - Valentina Studio. Its free edition can do things more than many commercial tools!!
    I very recommend check it. http://www.valentina-db.com/en/valentina-studio-overview

    ReplyDelete
  3. We provide best solution of Dll error remove just click this link and free from rundll error.
    How To Remove Rundll Error
    Thanks
    Aalia lyon

    ReplyDelete
  4. Awesome blog!!! It's so informative for you to get a software applications run faster on the Windows based PC.visit this link and free from all error of windows 7 problem.
    How To Remove Rundll Error
    Thanks
    Aalia lyon

    ReplyDelete
  5. when i check in the wamp server tray icon, i can find php_imagick and a tick against it, but i cannot find it in phpinfo() .. any suggestions?

    ReplyDelete