# Gaussian Blur Filters

## Gaussian Blur Kernel Filter

Unlike common BlurBox image filters using a box or averaging filter, applies a simple average to the pixel values in a defined neighborhood. This results in a uniform and straightforward blurring effect, where each pixel contributes equally to its neighbors. On the other hand, Gaussian blur employs a Gaussian distribution to determine the weights of pixels in the neighborhood. This means that pixels closer to the center have higher weights, creating a smoother and more natural blurring effect. To emulate the Gaussian distribution, the following 3x3 matrix can be used:

```
// gaussian blur 3x3 kernel
{
{1, 2, 1,},
{2, 4, 2,},
{1, 2, 1,},
};
```

To preserve the luminosity of the source image, all elements are divided by 16, which represents the sum of the matrix elements.

```
// gaussian blur 3x3 kernel /16
double[,] customKernel = new double[,]
{
{ 0.0625, 0.125, 0.0625,},
{ 0.125, 0.25, 0.125,},
{ 0.0625, 0.125, 0.0625,},
};
```

Gaussian blur tends to produce a more visually appealing and realistic result compared to the uniform blurring of common blur filters.

## C# code example

The following C# code example illustrates the usage of the Aspose.Imaging .NET API. You can employ the `ConvolutionFilter` class, which offers predefined kernel filters such as **GetGaussian()** method with adjustable size and sigma value of Gauss distribution. Additionally, you have the flexibility to create your custom kernel matrix. In this example, image templates in PNG and SVG formats are loaded from the "templates" folder, and filters are applied from a predefined list.