SVG <feMorphology> Filter
You are Here:
What is <feMorphology> Filter?
The <feMorphology>
SVG filter primitive is used to erode or dilate the input image.
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
Attribute | Explanation |
---|---|
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. |
Reminder
Hi Developers, we almost covered 91% of SVG Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in SVG.
Please do google search for:
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.