SVG feMorphology Element

|  | Search W3Schools : |

HOME | HTML | CSS | XML | JAVASCRIPT | ASP | PHP | SQL | MORE... |  | References | Examples | Forum | About

ADVERTISEMENTS XML Certification Download XML editor Custom Programming |  |

Table of contents

SVG Basic
SVG HOME
SVG Intro
SVG Example
SVG in HTML
SVG Shapes
SVG Rectangle
SVG Circle
SVG Ellipse
SVG Line
SVG Polygon
SVG Polyline
SVG Path
SVG Filters
SVG Intro
SVG Gaussian
SVG Gradients
SVG Linear
SVG Radial
SVG Examples
SVG Examples
SVG Reference
SVG Elements

Selected Reading

Web Statistics
Web Glossary
Web Hosting
Web Quality
W3Schools Tutorials
W3Schools Forum
Helping W3Schools

# SVG feMorphology Element

Complete SVG Reference

## Definition and Usage

The SVG feMorphology element is used to "fattening" or "thinning" a source graphic.

The operator attribute defines whether to erode or dilate the source graphic. The operator attribute can take one of the following values:

- erode (thinning)
- dilate (fattening)

The radius attribute defines the radius for the operation. If two numbers are specified, the first number is the x-radius and the second number is the y-radius. If one number is specified, then that value is used for both x and y. Default is 0

### Example 1

The following example shows examples of six types of feMorphology operations.

Copy the following code into Notepad and save the file as "femorphology_1.svg". Place the file in your Web directory:

    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

    <svg width="100%" height="100%" version="1.1"
    xmlns="http://www.w3.org/2000/svg">

    <defs>
    <filter id="Erode1">
    <feMorphology operator="erode" in="SourceGraphic" radius="1" />
    </filter>
    <filter id="Erode3">
    <feMorphology operator="erode" in="SourceGraphic" radius="3" />
    </filter>
    <filter id="Erode4">
    <feMorphology operator="erode" in="SourceGraphic" radius="4" />
    </filter>
    <filter id="Dilate1">
    <feMorphology operator="dilate" in="SourceGraphic" radius="1" />
    </filter>
    <filter id="Dilate3">
    <feMorphology operator="dilate" in="SourceGraphic" radius="3" />
    </filter>
    <filter id="Dilate4">
    <feMorphology operator="dilate" in="SourceGraphic" radius="4" />
    </filter>
    </defs>

    <g enable-background="new" >
    <g font-family="Verdana" font-size="50"
    stroke="red" stroke-width="4">
    <text x="50" y="60">Unfiltered</text>
    <text x="50" y="120" filter="url(#Erode1)">Erode 1</text>
    <text x="50" y="180" filter="url(#Erode3)">Erode 3</text>
    <text x="50" y="240" filter="url(#Erode4)">Erode 4</text>
    <text x="50" y="300" filter="url(#Dilate1)">Dilate 1</text>
    <text x="50" y="360" filter="url(#Dilate3)">Dilate 3</text>
    <text x="50" y="420" filter="url(#Dilate4)">Dilate 4</text>
    </g>
    </g>

    </svg>

View example

Complete SVG Reference

## Altova® XMLSpy® - The world's best-selling XML editor!

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web services development needs from start to finish.

- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!

Download a fully functional free 30-day trial today!

WEB HOSTING
ASP.NET Shopping Cart
$15 Domain Name Registration Save $20 / year!
Buy UK Domain Names Register Domain Names
Cheap Domain Names Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting

WEB BUILDING
Website Templates Flash Templates Website Builder Internet Business Opportunity
Custom Programming
FREE Trial or Demo Web Content Manager Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates

EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

HOME or Top of Page |  | Printer Friendly
W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy. Copyright 1999-2009 by Refsnes Data. All Rights Reserved.