From the course: SVG: Clipping, Masking, and Filters

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

feConvolveMatrix

feConvolveMatrix

From the course: SVG: Clipping, Masking, and Filters

Start my 1-month free trial

feConvolveMatrix

- The last filter primitive is feConvolveMatrix which allows us to remap the value of a pixel based on its adjacent pixels using a kernelmatrix. feConvolveMatrix can be used to build custom effects like blur and sharpen, edge detection, edge paint, pulsarization, extrusion and so on. In fact, many of the other filter primitives use a convolution matrix to achieve their results. The key to the feConvolveMatrix filter primitive is the kernelMatrix. By default this matrix used is a three by three grid representing nine pixels in a square. The center pixel is the current input pixel we want to change. The other eight are the eight pixels around it. feConvolveMatrix uses the kernelMatrix to calculate the new value for the center pixel. It does so by taking the original value of each of the color channels in each of the pixels in the matrix on the left multiplying it with the number in the kernelMatrix on the right, adding all the values in the matrix on the left together and dividing it by…

Contents