mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
images: Text filter that draws text with the given options (#9239)
Fixes #9238
This commit is contained in:
committed by
GitHub
parent
5538507e90
commit
283394a4fd
@@ -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 %}}
|
||||
|
Reference in New Issue
Block a user