Recently, I’ve been contributing to Imagine a lot. Imagine is a PHP Image Processing library. It provide an OO abstract layer for processing image with the driver of your choice (Graphics Magick, ImageMagick or GD). The code is quite cool, you should have a look to it.
As I’m having heavy use of this library and was missing some features, I’ve dug the code and I’m now contributing a lot. One of the feature I’m currently working on is ExactImage support. Although ExactImage PHP bindings have been used in production at Skyrock, I didn’t know this lib before somebody asked for it on GitHub and it seems the internet does not know so much about it.
ExactImage is an opensource library developed in Germany by a R&D company focused on image/audio digital signal processing. It has an ImageMagick-like command line API and has been designed for speed.
“In the mid-2000s we were wondering about the ridiculous amounts of CPU cycles ImageMagick spent on certain image processing tasks. After the first code review it became clear that imagemagick was coded for anything but speed”
It uses Swig to generate binding for Perl, Lua, Ruby, Python, PHP. The PHP API is not documented online at all. That’s probably why it’s not used so much.
I’ve posted on GitHub a beginning of the ExactImage PHP API doc. Use it, fork it, share it ! It’s open source, man !
Here are some examples of common image processing compared to Imagick API :
$imagick = new \Imagick();
$image = newImage();
$imagick->cropImage($width, $height, $x, $y);
imageCrop($image, $x, $y, $width, $height);
new \ImagickPixel('fff'), 90);
setbackgroundcolor(1.0, 1.0, 1.0, 1.0);
Swig provides the PHP extension, defining the same functions as in the original C library. When you call a PHP function, Swig looks for a match between the function you’re calling and its signature (ie the type of the parameters you passed) and the declared functions of ExactImage. For some functions, if you do not use exactly right types, it will result in a fatal error. For example, using setBackgroundColor with integer will produce :
PHP Fatal error: No matching function for overloaded
setBackgroundColor MUST be used with float values :
void setBackgroundColor(float $red,
float $green, float $blue, float $alpha)
This is unusual in PHP, and I’ve spent some time fighting with the library before having realized that : )
One drawback to exactimage : It does not prefix its functions, and, as it declares functions with the same name as GD (imagerotate), you can not load both extensions at the same time.
More infos :
Edit 1 :
See doxygen documentation http://fossies.org/dox/exact-image-0.8.7