# Image Convolution

Apply your own convolution kernel to an image. Enter a 3x3 or 5x5 matrix of weights, an optional scale that divides the result and an offset that is added afterwards, and the tool runs the filter over every color channel. Build sharpen, blur, edge, emboss and motion filters, test kernels from a textbook or prototype image processing ideas without writing code.

## Frequently asked questions

### How do I enter a kernel?

Type 9 numbers for a 3x3 kernel or 25 numbers for a 5x5 kernel, separated by spaces, commas or line breaks, row by row from the top left. The default 0 -1 0 / -1 5 -1 / 0 -1 0 is a classic sharpening kernel. Each weight must be between -1000 and 1000.

### What does the scale do?

The weighted sum of each pixel is divided by the scale before the offset is added. With the default of 0 the tool uses the sum of the kernel when it is positive and 1 otherwise, which keeps overall brightness for blur and sharpen kernels. You can enter any scale up to 1000 to normalize a kernel yourself.

### What is the offset for?

The offset, from -255 to 255, is added to every result after scaling. Edge and emboss kernels often produce values around zero, so an offset of 128 moves them to mid gray where both positive and negative responses are visible. Results outside 0 to 255 are clipped.

### Which kernels are useful to start with?

A box blur is nine 1s, a Gaussian blur is 1 2 1 / 2 4 2 / 1 2 1, an edge detector is -1 -1 -1 / -1 8 -1 / -1 -1 -1 and an emboss is -2 -1 0 / -1 1 1 / 0 1 2. For a stronger blur, use a 5x5 kernel of twenty five 1s.

### Is the filter applied to all channels?

The kernel runs on each color channel separately, so red, green and blue are filtered in the same way. The alpha channel is set aside before filtering and restored afterwards, so transparency is never blurred or sharpened. The result is saved as PNG.

### Why is my result black or white?

If the kernel weights sum to zero and no offset is used, flat areas become black because their response is zero. If the weights sum to a large positive number and the scale is too small, everything clips to white. Use the automatic scale or add an offset of 128 to see the full response.

### Does the image size change?

No, the output has the same width and height as the input. Pixels near the border are filtered using the neighboring pixels available at the edge. Images over 4000 pixels on a side are scaled down to fit before filtering.

### Which formats can I upload?

JPEG, PNG, GIF, WebP, TIFF and AVIF images up to 5 MB are supported, and animated files use their first frame. The filtered image is downloaded as a lossless PNG.

### Why only 3x3 and 5x5 kernels?

These two sizes cover nearly all classic filters and keep each request fast on large images. Bigger blurs are better done with a dedicated blur tool, which uses a separable Gaussian. If you need a wider effect, run the tool twice.

### What engine runs the convolution?

The tool uses the convolve operation of the sharp library, built on libvips. The calculation is exact for the weights you enter and the same input always produces the same output.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad The agent-ready plugin suite for WordPress.](https://sleekwp.com/?ref=oneclickpro)
