View Full Version : GD Library vs Imagemagick

08-21-2006, 05:23 PM
I've been playing around with PHP and using the GD Libary to
resize .jpg images. The tutorials I've been reading say things
like this:

PHP comes with two functions to do this: imagecopyresize() and imagecopyresampled(). The first function simply resizes the image, whilst the second function will resize but also resample the image. This means that the second function will create a resized image that looks much better.


So, I experimented with "resample" and noticed it seemed really slow.

I then went back to using Perl with Imagemagick. The Imagemagick
results always have higher quality resizing and much faster. So I'm
sticking with Perl Imagemagick.


Does anyone else have an idea of why using PHP GD is seemingly slow
and poor quality? Am I missing something with the tutorials I'm reading?

Just curious.

08-22-2006, 11:36 AM
After you resize the image and save it as a new JPG, make sure to pass a high quality value to imagejpeg() (the third parameter).

As for the speed issue .. I've never noticed that before. I use the function in countless of scripts and it never takes any longer to resize a bunch of JPGs than it does to display a form.. Well, minus the uploading of course.

08-22-2006, 03:15 PM
Personally I find ImageMagick faster and easier to use than GD but you dont need to use PerlMagick you can simply exec the binaries....

$command = 'convert image.jpg --crop 10x10 image.gif';

There is a PECL ImageMagick module out there as well but I could never get it to work nor do I really see the point?

08-22-2006, 04:22 PM
firepages .... about "exec binaries" ...

Can that be done with a webhost, or only using my own server?

I'm guessing that a webhost won't allow it.

08-23-2006, 12:10 AM
most hosts allow exec() etc and many have imagemagick installed .. but not all