The switch from GD to imageMagick


example of the difference between GD and imageMagick
example of the difference between GD and imageMagick

Recently I launched a new photo site called cape.photography. For years I have been using the GD library in PHP for image manipulation basically just re-sizing images.  This has never seemed to be an issue I think because I was always uploading the actual size I needed then making the thumbnails on the server so in a small thumbnail it looked fine. With this new application everything is being re-sized multiple times for different views. This is where we noticed the problem nice sharp saturated photos were coming out the other end as washed out versions. Obviously this is totally unacceptable on an photo specific site. So began the hunt.

UPDATE: I recently switched from being a windows user to a Mac lover and in doing this I had to set up a development environment on the mac and well it makes installing imageMagick trivial. So I guess I just feel a little silly for staying with windows for so long.

I started by making sure GD was saving everything at 100% and it made no difference. So a few google searches later I found imageMagick and decided to give it a try. Well in short it did the trick. imageMagick is simply awesome it has a great object oriented interface so the coding is very easy and the images looked awesome. The problem came in trying to get it running on my local development environment. I use a windows laptop running WAMP.

There are a number of tutorials that will get you so close to having imageMagick work in this configuration you can taste it. BUT none of them give you the final little bit of knowledge to make it actually work.

So to get it to work follow one of the tutorials already out there they will inform you to add a .dll file, install the imageMagick on your computer, and add imageMagick to your php.ini file. This will all work great you will feel like you did it only you will get errors in your php error log saying that imageMagick is not a windows program blah blah blah. So after hours of this and scouring the internet I finally sorted it out.

You need to download the correct package from here http://pecl.php.net/package/imagick/3.1.2/windows unzip it and copy the files into the appropriate folders in your imageMagick directory. You will be overwriting what is there and that is a good thing. Once you so this it should work.

I hope this saves others the frustration I felt in not being able to find this last little bit.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.