Is ImageMagick convert faster then imagick php extension?
Is ImageMagick convert faster then imagick php extension?
Hello.
I would like to know if using exec(convert...) is faster than using the imagick extension.
I would like to know if using exec(convert...) is faster than using the imagick extension.
Re: Is ImageMagick convert faster then imagick php extension?
There is more overhead associated with using the ImageMagick command-line programs than calling ImageMagick from a script. However, the only way to be sure is to benchmark both (e.g. convert and IMagick).
Re: Is ImageMagick convert faster then imagick php extension?
Here are some speed tests I did a year or so ago.
http://www.rubblewebs.co.uk/imagemagick/notes/speed.php
It dpends on what you are doing and you would need to run some tests of your own which is not hard to do.
http://www.rubblewebs.co.uk/imagemagick/notes/speed.php
It dpends on what you are doing and you would need to run some tests of your own which is not hard to do.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is ImageMagick convert faster then imagick php extension?
Bonzo,
Nice tests. Have you also benchmarked IMagick vs Magickwand for PHP.
I have been curious about the comparisons both with regard to speed and to functionality, although I am convinced that neither IMagick nor Magickwand will have the full functionality (and documentation) that there is when using command line and thus "exec" with PHP.
Nice tests. Have you also benchmarked IMagick vs Magickwand for PHP.
I have been curious about the comparisons both with regard to speed and to functionality, although I am convinced that neither IMagick nor Magickwand will have the full functionality (and documentation) that there is when using command line and thus "exec" with PHP.
Re: Is ImageMagick convert faster then imagick php extension?
No I have not tried it against Magickwand as I have never used it. I will look into it and see if I can run the tests again.
Like you the reason I prefer to use the comand line is there are a lot more options against Imagick. With the command line you can use every option and build the code as you like but with Imagick and Magickwand you are restricted to what has been written.
Like you the reason I prefer to use the comand line is there are a lot more options against Imagick. With the command line you can use every option and build the code as you like but with Imagick and Magickwand you are restricted to what has been written.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is ImageMagick convert faster then imagick php extension?
It would be interesting to hear from the creator of IMagick regarding any (speed) tests that he has done and what approximate percent of the full command line capabilities have been implemented.
Re: Is ImageMagick convert faster then imagick php extension?
Forgot my new PC does not have Imagick or Magickwand.
I have installed Magickwand Ok and just need to find a suitable example to copy but I can not get Imagick to work. Everytime I enable it in the php.ini file I get an error "Entry point not found".
I will leave this for now until I get some more time tofind the problem.
I have installed Magickwand Ok and just need to find a suitable example to copy but I can not get Imagick to work. Everytime I enable it in the php.ini file I get an error "Entry point not found".
I will leave this for now until I get some more time tofind the problem.
Re: Is ImageMagick convert faster then imagick php extension?
I copied my imagick.dll from my old PC to the new one and it works now.
Run a test 10 times and found the averidge and Imagick was the fastest on a 1mb image, command line with jpg hint next, Magickwand then the command line
On a larger image 3mb it was Command line with jpg hint, Imagick, command line then Magick wand.
Results are here : http://www.rubblewebs.co.uk/TESTS/results.html I will try and tidy them up later and add a GD test ( although I will probably get a memory error ).
Quad core PC running php 5.2.9 via Vista and a XAMPP server.
As you say Fred it would be interesting to get some input from the Imagick developer.
Another reason not to use Imagick and MagickWand is there is another lot of code to learn!
Run a test 10 times and found the averidge and Imagick was the fastest on a 1mb image, command line with jpg hint next, Magickwand then the command line
On a larger image 3mb it was Command line with jpg hint, Imagick, command line then Magick wand.
Results are here : http://www.rubblewebs.co.uk/TESTS/results.html I will try and tidy them up later and add a GD test ( although I will probably get a memory error ).
Quad core PC running php 5.2.9 via Vista and a XAMPP server.
As you say Fred it would be interesting to get some input from the Imagick developer.
Another reason not to use Imagick and MagickWand is there is another lot of code to learn!
Re: Is ImageMagick convert faster then imagick php extension?
Not really sure what I am doing with the Magickwand code but I have changed it from an image size of 100x100 to 100x75 and it takes longer !
Magickwand is the slowest in both tests. May be down to the code I am using:
Magick wand - is there a way to keep the image aspect ratio automaticaly ?
Command line
Command line with jpg hint
Imagick
GD
As I thought the GD code crashes on an image over 1mb.
Magickwand is the slowest in both tests. May be down to the code I am using:
Magick wand - is there a way to keep the image aspect ratio automaticaly ?
Code: Select all
$resource = NewMagickWand();
MagickReadImage( $resource, $image );
MagickResizeImage( $resource, 100, 75, MW_QuadraticFilter, 1.0 );
magickWriteImage( $resource, "wand.jpg" );
DestroyMagickWand( $resource );
Code: Select all
exec("convert $image -resize 100x100 command.jpg");
Code: Select all
exec("convert -size 100x100 $image -resize 100x100 hint.jpg");
Code: Select all
$thumbnail = new Imagick( $image );
$thumbnail->thumbnailImage( 100, 0 );
$thumbnail->writeImage( "imagick.jpg" );
Code: Select all
$size = getimagesize( $image );
// Set the new width of the image
$thumb_width = "100";
// Calculate the height of the new image to keep the aspect ratio
$thumb_height = ( int )(( $thumb_width/$size[0] )*$size[1] );
// Create a new true color image in the memory
$thumbnail = ImageCreateTrueColor( $thumb_width, $thumb_height );
// Create a new image from file
$src_img = ImageCreateFromJPEG( $image );
// Create the resized image
ImageCopyResampled( $thumbnail, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $size[0], $size[1] );
// Save the image as resized.jpg
ImageJPEG( $thumbnail, "gd.jpg" );
// Clear the memory of the tempory image
ImageDestroy( $thumbnail );
Last edited by Bonzo on 2009-07-31T00:43:47-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is ImageMagick convert faster then imagick php extension?
Thanks for all your hard work. This looks very interesting and useful. I am surprised that Magickwand is so slow as it is an API.
I would be interested if anyone can repeat this with PerlMagick for comparison.
I would be interested if anyone can repeat this with PerlMagick for comparison.