Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoDocs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-21 17:24:54 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-22 16:57:35 +0300
commitaf4a823b14733d348fe4ec299d2f56bd7f8331c1 (patch)
tree2e4ea6ab6cdbc8faa98f58404769cdec37cba4dc
parente11968338340b86cce616762b1596da88c5e93a5 (diff)
resources/images: Add $image.Colors
Which returns the most dominant colors of an image using a simple histogram method. Fixes #10307
-rw-r--r--content/en/content-management/image-processing/index.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/content/en/content-management/image-processing/index.md b/content/en/content-management/image-processing/index.md
index f2748f5db..d99ea7846 100644
--- a/content/en/content-management/image-processing/index.md
+++ b/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.