SVG Blur Effects

The SVG <feGaussianBlur> element is used to create blur effects:

Syntax:

<feGaussianBlur in="SourceGraphic" stdDeviation="5" />

Attributes:

  • in: It is used to identifies input for the given filter primitive.
  • stdDeviation: It is used to defines the standard deviation for the blur operation.
  • edgeMode: It is used to determines how to extend the input image as necessary with color values.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<body>
  
<svg height="400" width="400">
  <defs>
    <filter id="gfgid" x="0.5" y="0.5">
      <feGaussianBlur in="SourceGraphic"
                      stdDeviation="10" />
    </filter>
  </defs>
  
  <rect width="120" height="120"
        stroke="green" stroke-width="4"
        fill="green" filter="url(#gfgid)" />
</svg>
  
</body>
</html>

chevron_right


Output:



Example: Customize blurry circle.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<body>
  
<svg height="400" width="400">
  <defs>
    <filter id="gfgid" x="0" y="0">
      <feGaussianBlur in="SourceGraphic"
                      stdDeviation="05" />
    </filter>
  </defs>
  
        <circle cx="40" cy="40" r="50"
                stroke="black" stroke-width="2"
                fill="grey" filter="url(#gfgid)"/> 
  </svg>
  
</body>
</html>

chevron_right


Output:

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.