mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02:00
Add a set of image filters
With this you can do variants of this: ``` {{ $img := resources.Get "images/misc/3-jenny.jpg" }} {{ $img := $img.Resize "300x" }} {{ $g1 := $img.Filter images.Grayscale }} {{ $g2 := $img | images.Filter (images.Saturate 30) (images.GaussianBlur 3) }} ``` Fixes #6255
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/disintegration/gift"
|
||||
"github.com/spf13/afero"
|
||||
|
||||
bp "github.com/gohugoio/hugo/bufferpool"
|
||||
@@ -172,6 +173,10 @@ func (r *resourceAdapter) Fit(spec string) (resource.Image, error) {
|
||||
return r.getImageOps().Fit(spec)
|
||||
}
|
||||
|
||||
func (r *resourceAdapter) Filter(filters ...gift.Filter) (resource.Image, error) {
|
||||
return r.getImageOps().Filter(filters...)
|
||||
}
|
||||
|
||||
func (r *resourceAdapter) Height() int {
|
||||
return r.getImageOps().Height()
|
||||
}
|
||||
|
Reference in New Issue
Block a user