- The Imagick::fxImage() function is an inbuilt function in PHP which evaluate expression for each pixel in the image.
- The Imagick::fxImage() function allows you to perform image manipulation by processing set of FX expressions for each pixel with in the image.
Syntax:
Imagick::fxImage ( string $expression [, int $channel = Imagick::CHANNEL_DEFAULT ] )
Parameters:
- $expression
Its is FX expressions for image Manipulation. - $channel
Any channel constant can be fetched based on valid channel mode. If more channel constant need to add use bitwise operators to merge channeltype constants.
-
Return Value:
- Imagick::fxImage function will returns TRUE if success or returns
FALSE on failure.
Example 1:
To illustrate image manipulation by FX expression using Imagick::fxImage() function.
<?php // Imagick-fxImage $imagick = new \Imagick(); //new pseudo image $imagick->newPseudoImage(200, 200, "gradient:white-black"); //$fx value applied $fx = 'floor(s*10+0.5)/10'; $fxImage = $imagick->fxImage($fx); //Display Image header("Content-Type: image/png"); $fxImage->setimageformat('png'); echo $fxImage->getImageBlob(); ?> |
chevron_right
filter_none
Output:

Example 2:
To illustrate image manipulation by FX expression using Imagick::fxImage() function.
<?php // Imagick-fxImage $imagick = new \Imagick(); //New pseudo image $imagick->newPseudoImage(200, 200, "plasma:fractal"); //$fx value applied $fx = '(u.g+v.g)/2'; $fxImage = $imagick->fxImage($fx); //Display Image header("Content-Type: image/png"); $fxImage->setimageformat('png'); echo $fxImage->getImageBlob(); $fxImage->WriteImage('Imagick-fxImageex02.png'); ?> |
chevron_right
filter_none
Output:

Reference: https://www.php.net/manual/en/imagick.fximage.php
Recommended Posts:
- PHP | Imagick floodFillPaintImage() Function
- PHP | Imagick adaptiveSharpenImage() Function
- PHP | Imagick flopImage() Function
- PHP | Imagick setImageExtent() Function
- PHP | Imagick getImageWhitePoint() Function
- PHP | Imagick getCompressionQuality() Function
- PHP | Imagick clear() Function
- PHP | Imagick annotateImage() Function
- PHP | Imagick adaptiveResizeImage() Function
- PHP | Imagick adaptiveBlurImage() Function
- PHP | Imagick adaptiveThresholdImage() Function
- PHP | Imagick addNoiseImage() Function
- PHP | Imagick colorizeImage() Function
- PHP | Imagick addImage() Function
- PHP | Imagick setImageDispose() Function
- PHP | Imagick borderImage() Function
- PHP | Imagick getImageMatte() Function
- PHP | Imagick getImageMimeType() Function
- PHP | Imagick getImageRenderingIntent() Function
- PHP | imagick getImageDispose() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

