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:
Bjørn Erik Pedersen 2019-08-26 19:12:41 +02:00
parent f9978ed164
commit 823f53c861
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
89 changed files with 791 additions and 139 deletions

View file

@ -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()
}