images.Filter
Returns a new image resource created by applying one or more image filters to the given image resource.
- Syntax
- images.Filter FILTER... RESOURCE
- Returns
- images.ImageResource
Usage
The images.Filter function returns a new image resource created by applying one or more image filters to the given processable image. Use it to apply effects such as blurring, sharpening, or grayscale conversion.
This works with global resources, page resources, and remote resources.
You can also apply image filters with the Filter method on a Resource object.
Use the reflect.IsImageResourceProcessable function to verify that an image can be processed.
Use any of these filters with the images.Filter function or the Filter method:
images.AutoOrient- Returns an image filter that rotates and flips an image as needed per its Exif orientation tag.
images.Brightness- Returns an image filter that changes the brightness of an image.
images.ColorBalance- Returns an image filter that changes the color balance of an image.
images.Colorize- Returns an image filter that produces a colorized version of an image.
images.Contrast- Returns an image filter that changes the contrast of an image.
images.Dither- Returns an image filter that dithers an image.
images.Gamma- Returns an image filter that performs gamma correction on an image.
images.GaussianBlur- Returns an image filter that applies a Gaussian blur to an image.
images.Grayscale- Returns an image filter that produces a grayscale version of an image.
images.Hue- Returns an image filter that rotates the hue of an image.
images.Invert- Returns an image filter that negates the colors of an image.
images.Mask- Returns an image filter that applies a mask to an image.
images.Opacity- Returns an image filter that changes the opacity of an image.
images.Overlay- Returns an image filter that overlays the given image at the given coordinates, relative to the upper-left corner.
images.Padding- Returns an image filter that resizes the image canvas without resizing the image.
images.Pixelate- Returns an image filter that applies a pixelation effect to an image.
images.Process- Returns an image filter that processes an image according to the given processing specification.
images.QR- Returns an image resource containing a QR code encoded from the given text using the specified options.
images.Saturation- Returns an image filter that changes the saturation of an image.
images.Sepia- Returns an image filter that produces a sepia-toned version of an image.
images.Sigmoid- Returns an image filter that changes the contrast of an image using a sigmoidal function.
images.Text- Returns an image filter that adds text to an image.
images.UnsharpMask- Returns an image filter that sharpens an image.
Arguments
FILTER- (
images.filterorslice) One or more image filters, or a slice of image filters. Hugo applies the filters from left to right. RESOURCE- (
images.ImageResource) The image to filter.
Examples
{{ with resources.Get "images/original.jpg" }}
{{ with images.Filter images.Grayscale . }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
{{ end }}This is the original image:

This is the processed image:

Applying a slice of filters, from left to right:
{{ $filters := slice
images.Grayscale
(images.GaussianBlur 8)
}}
{{ with resources.Get "images/original.jpg" }}
{{ with images.Filter $filters . }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
{{ end }}Last updated:
November 17, 2026
:
content: Apply style guide to images functions (e302e964f)
Improve this page