Speed tests - Imagick vs MagickWand for PHP
Posted: 2012-03-02T03:13:04-07:00
I was interested in expanding Bonzo’s speed tests to include MagickWand For PHP. Specifically I wanted to compare Imagick vs. MagickWandForPHP. I wasn’t interested in comparing functionality (which differs between the two extensions) – I only wanted to know which one was faster.
Test were run timing the production of a 200x200 thumbnail from a larger jpg, using various methods:
- MagickWand - thumbnail using scale
- MagickWand - thumbnail using resize
- Imagick - thumbnail using scale
- Imagick - thumbnail using resize
- Imagick - thumbnail using thumbnailImage
- convert –resize
- convert -thumbnail
- convert –thumbnail with jpg hint
- GD - thumbnail using resize
Results:
Calling the binary program is generally the slowest as we would expect.
MagickWand for PHP and Imagick are identical in speed (in this test).
“ScaleImage" is significantly faster (1.3 x) than “ResizeImage” although this may not be true at all image sizes (e.g. larger image may give different results?)
In some cases calling the binary is approx the same time as using an extension. However when the jpg hint (i.e. the "-define jpeg:size=200x200" option) is used, exec(convert) is a whopping 3.5 x faster (and 2.5 x the speed of either Imagick or MWforPHP !).
GD is generally faster than ImageMagick but then we expect that – we are using ImageMagick for its quality and functionality!
Question 1: what’s the difference between ResizeImage and ScaleImage? I don’t know – perhaps it uses a “simpler” filter? Further testing might be required to see if there is a difference in quality between the two methods.
Question 2: why is the “jpg hint” option to “convert” sooo much faster, and is there any way to use this option in MagickWand for PHP or Imagick?
Of course this is only one (very) restricted test, and may not be representative of overall performance, but it’s the test in which I was interested.
Test procedure and detailed results are here: http://php-4-business.co.uk/scratchpad/speed_tests.pdf
Test were run timing the production of a 200x200 thumbnail from a larger jpg, using various methods:
- MagickWand - thumbnail using scale
- MagickWand - thumbnail using resize
- Imagick - thumbnail using scale
- Imagick - thumbnail using resize
- Imagick - thumbnail using thumbnailImage
- convert –resize
- convert -thumbnail
- convert –thumbnail with jpg hint
- GD - thumbnail using resize
Results:
Calling the binary program is generally the slowest as we would expect.
MagickWand for PHP and Imagick are identical in speed (in this test).
“ScaleImage" is significantly faster (1.3 x) than “ResizeImage” although this may not be true at all image sizes (e.g. larger image may give different results?)
In some cases calling the binary is approx the same time as using an extension. However when the jpg hint (i.e. the "-define jpeg:size=200x200" option) is used, exec(convert) is a whopping 3.5 x faster (and 2.5 x the speed of either Imagick or MWforPHP !).
GD is generally faster than ImageMagick but then we expect that – we are using ImageMagick for its quality and functionality!
Question 1: what’s the difference between ResizeImage and ScaleImage? I don’t know – perhaps it uses a “simpler” filter? Further testing might be required to see if there is a difference in quality between the two methods.
Question 2: why is the “jpg hint” option to “convert” sooo much faster, and is there any way to use this option in MagickWand for PHP or Imagick?
Of course this is only one (very) restricted test, and may not be representative of overall performance, but it’s the test in which I was interested.
Test procedure and detailed results are here: http://php-4-business.co.uk/scratchpad/speed_tests.pdf