HUGO
Menu
GitHub 90529 stars Mastodon

images.GaussianBlur

Returns an image filter that applies a Gaussian blur to an image.
Syntax
images.GaussianBlur SIGMA
Returns
images.filter

Usage

The images.GaussianBlur function returns an image filter that applies a Gaussian blur to an image.

Arguments

SIGMA
(float) The amount of blur, in pixels. The filter blends each pixel with neighboring pixels up to three times this distance away. A value of 0 or less has no effect.

Examples

{{ $filter := images.GaussianBlur 5 }}

Applying the filter with the images.Filter function:

{{ with resources.Get "images/original.jpg" }}
  {{ with . | images.Filter $filter }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}

Applying the filter with the Filter method on a Resource object:

{{ with resources.Get "images/original.jpg" }}
  {{ with .Filter $filter }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}

This is the original image:

Zion National Park

This is the processed image:

Zion National Park