mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03: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:
parent
f9978ed164
commit
823f53c861
89 changed files with 791 additions and 139 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue