images.Sigmoid
Returns an image filter that changes the contrast of an image using a sigmoidal function.
- Syntax
- images.Sigmoid MIDPOINT FACTOR
- Returns
- images.filter
Usage
The images.Sigmoid function returns an image filter that changes the contrast of an image using a sigmoidal function. This is a non-linear contrast change, useful for photo adjustments because, unlike the images.Contrast function, it preserves highlight and shadow detail.
Arguments
MIDPOINT- (
float) The brightness level around which the filter changes the contrast, on a scale from0(black) to1(white). When the filter increases contrast, tones darker than this level become darker, and tones lighter than this level become lighter. A value of0.5centers the change on middle gray, a lower value focuses the change on the shadows, and a higher value focuses the change on the highlights. Values outside the range[0, 1]are treated as0or1. FACTOR- (
float) The change in contrast, typically in the range[-10, 10]. A positive value increases contrast, a negative value decreases contrast, and a value of0has no effect. Values close to0, such as2or-2, produce a subtle change, and values close to10or-10produce a strong change.
Examples
{{ $filter := images.Sigmoid 0.6 -4 }}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