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.
Syntax:
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.
<?php // 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(); ?> |
Output:

Recommended Posts:
- PHP | Imagick getImageGravity() Function
- PHP | Imagick getImageCompressionQuality() Function
- PHP | Imagick setOption() Function
- PHP | Imagick getOption() Function
- PHP | Imagick getIteratorIndex() Function
- PHP | Imagick setImageColorspace() Function
- PHP | Imagick getImageVirtualPixelMethod() Function
- PHP | Imagick setImageIndex() Function
- PHP | Imagick stripImage() Function
- PHP | Imagick getNumberImages() Function
- PHP | Imagick setIteratorIndex() Function
- PHP | Imagick setImageScene() Function
- PHP | Imagick setImageDelay() Function
- PHP | Imagick evaluateImage() Function
- PHP | Imagick getImagesBlob() Function
- PHP | Imagick getImageExtrema() Function
- PHP | Imagick setImageCompressionQuality() Function
- PHP | Imagick getImageDistortion() Function
- PHP | Imagick getImageFilename() Function
- PHP | Imagick setImageCompression() 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.

