Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,466
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts

    GD Library vs Imagemagick

    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.

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    34
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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 Code:
    <?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?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,466
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    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.

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    most hosts allow exec() etc and many have imagemagick installed .. but not all
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •