HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

FX image

← functionImage   gammaImage →
Evaluate expression for each pixel in the image. Consult The Fx Special Effects Image Operator for more information.

The fxImage function allows you to define almost any possible image manipulation by defining the operation to perform as a string composed of a large selection of variables.

For the list of possible variables please see the FX reference sheet. For a list of examples and another description of how it can be used please see the ImageMagick Examples page.

And yes, it is very, very slow. You should only use it if you need an image generating that can't be generated any other way, or if you wish to generate a

Example

function fxImage()
{
    $imagick = new \Imagick();
    $imagick->newPseudoImage(200, 200, "xc:white");

    $fx = 'xx=i-w/2; yy=j-h/2; rr=hypot(xx,yy); (.5-rr/140)*1.2+.5';
    $fxImage = $imagick->fxImage($fx);

    header("Content-Type: image/png");
    $fxImage->setimageformat('png');
    echo $fxImage->getImageBlob();
}