SVG <feMorphology> Filter

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
inSpecifies the input for the given filter primitive.
operatorSpecifies whether to erode (i.e., thin) or dilate (fatten) the source graphic.
radiusSpecifies the radius (or radii) for the operation on a given <feMorphology> filter primitive.

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author