# Blending neighboring pixels together

### Question

Disclaimer: This is my first real time using Gimp, so I apologize if this is a basic question.

I'm trying to blend the colors of my pixels together based on the neighboring pixels. For example, consider the following 9 pixels.

```
0 1 2
3 4 5
6 7 8
```

Suppose that each number represents a value in a color channel. I'm looking for a tool such that given a pixel p, p's new value will the average of its (at most 8) surrounding pixels and itself.

The new values of the pixels above should be, after rounding:

```
2 4 3
4 4 5
5 6 6
```

Can someone point me towards a tool that can help achieve this?

### Accepted Answer

This operation in Image Processing is called aplication of a Convolution Matrix - in GIMP, there is a filter that allows you to do exactly this, experimenting with various weights for each neighboring pixel - just check it under `Filters->Generic->Convolution Matrix`

(if your objective is specifically the average, it is possible it is the operation that is achieved by the simple (not the Gaussian) blur filter - under `filters->blur`

- the Convolution Matrix, though, will allow you to achieve exactly what you want)