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 outputFor 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 benchmarkRemember, 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.
If you liked this blog post, or learned something please consider using flattr to contribute back: .
Trackbacks
Comments
-
Christian Otto at Fri, 29 Feb 2008 12:49:29 +0100
Hi,
Link to comment
would you mind releasing the sourcecode, of this graph?
Looks pretty, and would be an great example!
Greetings,
Christian -
Kore at Fri, 07 Mar 2008 15:32:48 +0100
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.
Link to comment -
Raul at Tue, 28 Oct 2008 16:00:35 +0100
Did you find the source code?
Link to comment -
Fer at Thu, 30 Oct 2008 21:13:48 +0100
Hi!
Link to comment
How do you do the coloured border line of the "polygons"
Regards,
Fer
Fields with bold names are mandatory.
New features in eZ Components Graph 1.3 on Sun, 24 May 2009 12:57:38 +0200 in Kore Nordmann - PHP / Projects / Politics
There are some interesting new features in the driver part of the graph
component of the eZ components - one thing I even thought is "impossible"
until some external submission...