mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
resources/images: Add $image.Colors
Which returns the most dominant colors of an image using a simple histogram method. Fixes #10307
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user