...

View Full Version : GD Library vs Imagemagick



mlseim
08-21-2006, 06: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.

Nimlhg
08-22-2006, 12:36 PM
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.

firepages
08-22-2006, 04: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....



<?php
$command = 'convert image.jpg --crop 10x10 image.gif';
exec($command);
?>


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?

mlseim
08-22-2006, 05: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.

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum