Comparison of PHP image libraries - Update - Kore Nordmann

Comparison of PHP image libraries - Update

I find this always a bit hard to phrase, because I am not only comparing libraries here, but also formats or extensions which are just used to create some graphic, which also may be used for something completely different (DOM). I am talking about general ways to create graphics with PHP here.

In my article series I showed several ways on how to create images with PHP, going into implementation details etc. Now I just want to provide a very rough overview on speed and quality of the extensions.

* kn::Graphic::Svg (250): 0.0363s (0.000145) * kn::Graphic::Cairo (250): 0.1328s (0.000531) * kn::Graphic::Flash (250): 0.1353s (0.000541) * kn::Graphic::GdWithoutSupersampling (250): 0.1660s (0.000664) * kn::Graphic::iMagick (250): 0.2822s (0.001129) * kn::Graphic::Gd (250): 0.3394s (0.001357)
iMagick outputiMagick output

For this microbenchmark I disabled stuff like the border size reduction, which would cost some additional time for SVG and Flash generation, but I am not really sure if you would always need that.

As you can see, and I expected, iMagick is not that fast, when it comes to image generation. The focus of the library is image manipulation and composition of images. The quality of the image is quite good, far better then the GD stuff, but it also does not really support gradients in shapes yet. See this forum entry for details.

And here is a small graphical overview of the benchmark, looking nicer then the plain numbers:

PHP image library benchmarkPHP image library benchmark

Remember, that the values on the Y axis are in milliseconds. The values are the average time for one run, when I run the image creation script with all the libraries each 250 times. The benchmark code is the same, like in the last posting - I just added a wrapper for iMagick and run all the stuff again.

If you want to learn more about iMagick, you should definitely check out Mikko's blog, where he regularly shows interesting examples for the new iMagick API, which also really proofed helpful while developing the new backend.

Btw, the graph has been rendered with graph component from the eZ Components, with the cairo output driver, I just added to SVN, which will be available in the next major release, or in trunk from now on.