FYI: Test Results Comparing Different Methods of Resizing Images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Rostkowski

    #1

    FYI: Test Results Comparing Different Methods of Resizing Images

    I posted this in alt.php, but as a reply, so now I'm posting it here for
    people
    who might have missed it but still could find it useful. Thanks to Andy
    Hassall for
    giving me good information.

    I compared the smooth image resampling used in PHP to create good quality
    thumbnails of large images, used commonly in image galleries. i compared
    ImageMagick and PHP (with GD2) and compiled some statistics below.
    I ran two test. Both used a set of 10 photos around 3MP in size. On the
    first
    test, I created two thumbnails for each photo, one 700 pixels in width and
    another at 120 pixels in width. On the second test, I created just one
    thumbnail, 120 pixels in width. Time was counted in "minutes.second s."


    TEST#1 -- IMAGEMAGICK*
    -----------------------------------------------------------
    METHOD TIME IMAGE QUALITY
    thumbnail 1.33 good
    sample 0.24 bad
    resize 1.33 good
    size/geometry 0.42 good

    TEST #1 -- GD2 (PHP)
    -----------------------------------------------------------
    METHOD TIME IMAGE QUALITY
    Imagecopyresamp led 1.57 good


    TEST#2 -- IMAGEMAGICK*
    -----------------------------------------------------------
    METHOD TIME IMAGE QUALITY
    thumbnail 0.26 good
    sample 0.19 bad
    resize 1.13 good
    size/geometry 0.06 good

    TEST #2 -- GD2 (PHP)
    -----------------------------------------------------------
    METHOD TIME IMAGE QUALITY
    Imagecopyresamp led 0.56 good


    *ImageMagick Command Methods:
    thumbnail : convert -thumbnail $destSize $sourceFile $targetFile
    sample : convert -sample $destSize $sourceFile $targetFile
    resize : convert -resize $destSize $sourceFile $targetFile
    size/geometry : convert -size $destSize $sourceFile -geometry $destSize
    $targetFile

    CONCLUSIONS:
    -----------------------------------------------------------
    There were four different imagemagick commands I tried out in all. Overall,
    the winner came out to be the imagemagick command. This
    method beat out PHP by a good margin, creating thumbnails in about 1/3 the
    time it took PHP with similar quality in the first test, and then taking the
    cake
    in the second test by creating thumbnails in about 1/10 the time as PHP.

    Imagemagick seems to increase in performance compared to PHP when creating
    a smaller thumbnail versus a relatively large thumbnail, as seen by test #2
    versus test #1. This means that a site creating small thumbnails will see
    even more of an advantage by using Imagemagick.

    The fraction of the time it takes for imagemagick to create smaller
    thumbnails makes it almost necessary to use for dynamically created
    thumbnail galleries that need to trim resources.

    MR



Working...