HUGO
Menu
GitHub 90529 stars Mastodon

images.Saturation

Returns an image filter that changes the saturation of an image.
Syntax
images.Saturation AMOUNT
Returns
images.filter

Usage

The images.Saturation function returns an image filter that changes the saturation of an image.

Arguments

AMOUNT
(float) The percentage change in saturation, in the range [-100, 500]. A value of 0 has no effect.

Examples

{{ $filter := images.Saturation 65 }}

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