images.Colorize
Returns an image filter that produces a colorized version of an image.
- Syntax
- images.Colorize HUE SATURATION STRENGTH
- Returns
- images.filter
Usage
The images.Colorize function returns an image filter that produces a colorized version of an image. The filter replaces the hue and saturation of each pixel with the given values, and keeps the lightness of each pixel. To shift the existing colors of an image instead of replacing them, use the images.Hue function.
Arguments
HUE- (
float) The color to apply, expressed as an angle on the color wheel, in degrees. For example,0is red,60is yellow,120is green,180is cyan,240is blue, and300is magenta. Values outside the range[0, 360]wrap around the color wheel, so-120and600are the same as240. SATURATION- (
float) The intensity of the color to apply, as a percentage in the range[0, 100]. A value of0produces a grayscale image, and a value of100applies the most intense version of the color. STRENGTH- (
float) The strength of the effect, as a percentage in the range[0, 100].
Examples
{{ $filter := images.Colorize 180 50 20 }}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:

This is the processed image:

Last updated:
November 17, 2026
:
content: Apply style guide to images functions (e302e964f)
Improve this page