images.Gamma
Returns an image filter that performs gamma correction on an image.
- Syntax
- images.Gamma GAMMA
- Returns
- images.filter
Usage
The images.Gamma function returns an image filter that performs gamma correction on an image. Gamma correction lightens or darkens the midtones of an image without changing pure black or pure white. To change the brightness of every tone by the same amount, use the images.Brightness function instead.
Arguments
GAMMA- (
float) The gamma value, typically in the range[0.5, 2]. A value greater than1lightens the midtones, a value less than1darkens the midtones, and a value of1has no effect. A value of0or less produces a black image.
Examples
{{ $filter := images.Gamma 1.667 }}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