mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
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:
@@ -533,6 +533,11 @@ func TestImageOperationsGolden(t *testing.T) {
|
||||
fmt.Println(workDir)
|
||||
}
|
||||
|
||||
gopher := fetchImageForSpec(spec, c, "gopher-hero8.png")
|
||||
var err error
|
||||
gopher, err = gopher.Resize("30x")
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
||||
// Test PNGs with alpha channel.
|
||||
for _, img := range []string{"gopher-hero8.png", "gradient-circle.png"} {
|
||||
orig := fetchImageForSpec(spec, c, img)
|
||||
@@ -589,6 +594,7 @@ func TestImageOperationsGolden(t *testing.T) {
|
||||
f.Invert(),
|
||||
f.Hue(22),
|
||||
f.Contrast(32.5),
|
||||
f.Overlay(gopher.(images.ImageSource), 20, 30),
|
||||
}
|
||||
|
||||
resized, err := orig.Fill("400x200 center")
|
||||
|
Reference in New Issue
Block a user