SVG <feMorphology> Filter

Last Updated:

What is <feMorphology> Filter?

The <feMorphology> SVG filter primitive is used to erode or dilate the input image.

Thin text Normal text Fat text

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> text { font-family: Arial, Helvetica, sans-serif; font-size: 3em; } #thin { filter: url(#erode); } #thick { filter: url(#dilate); } </style> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" width="300" height="180"> <filter id="erode"> <feMorphology operator="erode" radius="1"/> </filter> <filter id="dilate"> <feMorphology operator="dilate" radius="2"/> </filter> <text id="thin" y="1em">Thin text</text> <text y="2em">Normal text</text> <text id="thick" y="3em">Fat text</text> </svg> </body> </html>

Attributes Value

AttributeExplanation
in Specifies the input for the given filter primitive.
operator Specifies whether to erode (i.e., thin) or dilate (fatten) the source graphic.
radius Specifies the radius (or radii) for the operation on a given <feMorphology> filter primitive.

Share this Page

Meet the Author