SVG <feConvolveMatrix> Element (original) (raw)

Last Updated : 31 Mar, 2022

SVG stands for Scalable Vector Graphic. It can be used to make graphics and animations like in HTML canvas.

The SVG filter primitive changes pixels in the input image with neighboring pixels to produce a resulting image.

Syntax:

Attributes:

Example 1:

html `

    <rect x="40" y="40" width="100" 
        height="100" 
        filter: url(#convolve) style=
            "stroke: #000000;
            fill: darkgreen;" />

    <g fill="#FFFFFF" stroke="black" 
        font-size="10" font-family="Verdana">

        <text x="50" y="90" 
            filter="url(#convolve)">
            GeeksForGeeks
        </text>
    </g>
</svg>

`

Output:

Example 2:

html `

SVG Filter
    <rect x="1" y="1" width="198" 
        height="118" 
        style="stroke: #000000; 
                fill: none;
                filter: url(#convolve);" />

    <circle cx="100" cy="60" r="55" 
        stroke="black" stroke-width="3" 
        fill="Lightgreen" 
        filter: url(#convolve) />

    <g fill="#FFFFFF" stroke="black" 
        font-size="10" font-family="Verdana">
        <text x="60" y="62" filter="url(#convolve)">
            GeeksForGeeks</text>
    </g>
</svg>

`

Output: