- Imagick::fxImage Function()- it is a built-in function in PHP that evaluates an expression for each pixel in an image.
- The Imagick::fxImage() function allows you to manipulate images by processing a set of FX expressions for each pixel in an image.
Imagick::fxImage (string $expression [, int $channel = Imagick::CHANNEL_DEFAULT])Options:
- $expression
These are FX expressions for manipulating images. - $channel
Any channel constant can be selected based on the actual channel mode. If you need to add more channel constant, use bitwise operators to combine channel type constants.
- Return value:
- Imagick function: : fxImagereturns TRUE onon success, or
FALSEon failure.
To illustrate image manipulation by an FX expression using the Imagick::fxImage()function.
// 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
);
// Show image
header (
"Content-Type: image / png"
);
$fxImage
-> setimageformat (
’png’
);
echo
$fxImage
-> getImageBlob();
?>
Output: Example 2:
To illustrate image manipulation by an FX expression using the Imagick::fxImage()function.
// Imagick-fxImage
$imagick
=
new
Imagick();
// New pseudo-image
$imagick
-> newPseudoImage (200, 200,
"plasma: fractal"
);
// $fx value applied
$fx
=
’(u.g + vg) / 2’
;
$fxImage
=
$imagick
-> fxImage (
$fx
);
// Show image
header (
" Content-Type: image / png "
);
$fxImage
-> setimageformat (
’png’
);
echo
$fxImage
-> getImageBlob();
$fxImage
-> WriteImage (
’Imagick-fxImageex02.png’
);
?>
Output: Link : https://www.php.net/manual/en/imagick .fximage.php