diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-09-21 16:24:54 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-09-22 15:57:35 +0200 |
commit | a4028112e340b20909746daca0f8cabb09cbf28f (patch) | |
tree | 3952d26c1d6fd4ac543617272b7a0311cd119339 /docs/content/en/content-management | |
parent | 08f0984f918bb97d35c1765d3b94b1a9a1a3b9cd (diff) |
resources/images: Add $image.Colors
Which returns the most dominant colors of an image using a simple histogram method.
Fixes #10307
Diffstat (limited to 'docs/content/en/content-management')
-rw-r--r-- | docs/content/en/content-management/image-processing/index.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/content/en/content-management/image-processing/index.md b/docs/content/en/content-management/image-processing/index.md index f2748f5db..d99ea7846 100644 --- a/docs/content/en/content-management/image-processing/index.md +++ b/docs/content/en/content-management/image-processing/index.md @@ -163,6 +163,19 @@ Sometimes it can be useful to create the filter chain once and then reuse it. {{ $image2 := $image2.Filter $filters }} ``` +### Colors + +{{< new-in "0.104.0" >}} + +`.Colors` returns a slice of hex string with the dominant colors in the image using a simple histogram method. + +```go-html-template +{{ $colors := $image.Colors }} +``` + +This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled down image. + + ### Exif Provides an [Exif] object containing image metadata. |