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
This commit is contained in:
Bjørn Erik Pedersen
2020-12-16 13:52:47 +01:00
parent a2d146ec32
commit 3ba147e702
12 changed files with 101 additions and 2 deletions

View File

@@ -14,6 +14,8 @@
package resource
import (
"image"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/media"
@@ -59,6 +61,9 @@ type ImageOps interface {
Resize(spec string) (Image, error)
Filter(filters ...interface{}) (Image, error)
Exif() *exif.Exif
// Internal
DecodeImage() (image.Image, error)
}
type ResourceTypeProvider interface {