images: Text filter that draws text with the given options (#9239)

Fixes #9238
This commit is contained in:
Paul van Brouwershaven
2021-12-07 11:29:55 +01:00
committed by GitHub
parent 5538507e90
commit 283394a4fd
15 changed files with 160 additions and 2 deletions

View File

@@ -40,6 +40,27 @@ A shorter version of the above, if you only need to apply the filter once:
The above will overlay `$logo` in the upper left corner of `$img` (at position `x=50, y=50`).
### Text
Using the `Text` filter, you can add text to an image.
{{% funcsig %}}
images.Text TEXT DICT)
{{% /funcsig %}}
The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
```
{{ $img := resources.Get "/images/background.png"}}
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
"color" "#ffffff"
"size" 60
"linespacing" 2
"x" 10
"y" 20
))}}
```
### Brightness
{{% funcsig %}}