Comparison of PHP image libraries - Update
First published at Thursday 20 December 2007
Warning: This blog post is more then 17 years old – read and use with care.
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)
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:
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.
Subscribe to updates
There are multiple ways to stay updated with new posts on my blog:
Comments
Christian Otto at Friday, 29.2. 2008
Hi, would you mind releasing the sourcecode, of this graph? Looks pretty, and would be an great example!
Greetings, Christian
Kore at Friday, 7.3. 2008
Sorry, I don't have the source anymore. But you may ask me during the next UG meeting, and I will recreate the chart for you.
Raul at Tuesday, 28.10. 2008
Did you find the source code?
Fer at Thursday, 30.10. 2008
Hi!
How do you do the coloured border line of the "polygons"
Regards,
Fer