The Imagick::filter() function is an inbuilt function in PHP which is used to apply custom convolution kernel to the image. A kernel, convolution matrix, or mask is a small matrix. It is used for blur, sharpen, embossing, edge detection, and many more.
bool Imagick::filter( $ImagickKernel, $channel = Imagick::CHANNEL_UNDEFINED )
Parameters: This function accepts two parameters as mentioned above and described below:
- $ImagickKernel: It is a kernel or a linked series of multiple kernels that are used to be apply on the image.
- $channel: It is a constant that is used on basis of the modes. It is of integer type and the default value of channel is Imagick::CHANNEL_DEFAULT.
Return Value: It returns true when the filter to the image is successfully applied.
Below program illustrates the Imagick::filter() function in PHP: