diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-12-16 13:52:47 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-12-17 09:14:18 +0100 |
commit | 3ba147e702a5ae0af6e8b3b0296d256c3246a546 (patch) | |
tree | be78ef8f1a2106bf8816f0a8c4f7872169353691 /resources/transform.go | |
parent | a2d146ec32a26ccca9ffa68d3c840ec5b08cca96 (diff) | |
download | hugo-3ba147e702a5ae0af6e8b3b0296d256c3246a546.tar.gz hugo-3ba147e702a5ae0af6e8b3b0296d256c3246a546.zip |
images: Add images.Overlay filter
This allows for constructs ala:
```
{{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}}
```
Or:
```
{{ $logoFilter := (images.Overlay $logo 50 50 ) }}
{{ $overlay := $img | images.Filter $logoFilter }}
```
Which will overlay the logo in the top left corner (x=50, y=50) of `$img`.
Fixes #8057
Fixes #4595
Updates #6731
Diffstat (limited to 'resources/transform.go')
-rw-r--r-- | resources/transform.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/resources/transform.go b/resources/transform.go index a9ec84671..9007ead18 100644 --- a/resources/transform.go +++ b/resources/transform.go @@ -16,6 +16,7 @@ package resources import ( "bytes" "fmt" + "image" "io" "path" "strings" @@ -264,6 +265,10 @@ func (r *resourceAdapter) Width() int { return r.getImageOps().Width() } +func (r *resourceAdapter) DecodeImage() (image.Image, error) { + return r.getImageOps().DecodeImage() +} + func (r *resourceAdapter) getImageOps() resource.ImageOps { img, ok := r.target.(resource.ImageOps) if !ok { |