aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/transform.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-08-26 19:12:41 +0200
committerBjørn Erik Pedersen <[email protected]>2019-08-28 15:59:54 +0200
commit823f53c861bb49aecc6104e0add39fc3b0729025 (patch)
tree64a55d1c41de09b67305ad69a3600f3091d4f1fc /resources/transform.go
parentf9978ed16476ca6d233a89669c62c798cdf9db9d (diff)
downloadhugo-823f53c861bb49aecc6104e0add39fc3b0729025.tar.gz
hugo-823f53c861bb49aecc6104e0add39fc3b0729025.zip
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
Diffstat (limited to 'resources/transform.go')
-rw-r--r--resources/transform.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/resources/transform.go b/resources/transform.go
index 72b9479df..0792515c4 100644
--- a/resources/transform.go
+++ b/resources/transform.go
@@ -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()
}