PHP | Imagick gaussianBlurImage() Function

The Imagick::gaussianBlurImage() function is an inbuilt function in PHP which is used to blur an image. This function convolves the image with a Gaussian operator of the given radius and standard deviation (sigma).

Note: For reasonable results, the radius should be larger than sigma.


bool Imagick::gaussianBlurImage( $radius, $sigma, $channel = Imagick::CHANNEL_DEFAULT )

Parameters: This function accepts three parameters as mentioned above and described below:

  • $radius (float type): This parameter gives the radius of the Gaussian area in pixels, excluding the center pixel.
  • $sigma (Float type): This parameter gives the standard deviation of the Gaussian area in pixels.
  • $channel (Int type): This parameter gives a channel (that is valid) as per our requirement. To apply more than one channel, use bitwise operator to combine channel-type constants.

Return Value: This function returns True on success.

Errors: This function throws ImagickException on error.

Original Image:

Now, we will write a PHP program that illustrates the Imagick::gaussianBlurImage() function in PHP to blur the above image.

Program: This program uses Imagick::gaussianBlurImage() function to blur the image.





// Create an Imagick object
$imagick = new Imagick(
// Use gaussianBlurImage() function to blur the image
$imagick->gaussianBlurImage(10, 8, Imagick::CHANNEL_DEFAULT);
// Image header
header("Content-Type: image/jpg");
// Display the output image
echo $imagick->getImageBlob();



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to 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.