mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-12 17:00:54 -04:00
parent
3186e6458d
commit
2e3573899e
@ -42,6 +42,8 @@ The above will overlay `$logo` in the upper left corner of `$img` (at position `
|
|||||||
|
|
||||||
### Text
|
### Text
|
||||||
|
|
||||||
|
{{< new-in "0.90.0" >}}
|
||||||
|
|
||||||
Using the `Text` filter, you can add text to an image.
|
Using the `Text` filter, you can add text to an image.
|
||||||
|
|
||||||
{{% funcsig %}}
|
{{% funcsig %}}
|
||||||
@ -50,7 +52,7 @@ images.Text TEXT DICT)
|
|||||||
|
|
||||||
The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
|
The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
|
||||||
|
|
||||||
```
|
```go-html-template
|
||||||
{{ $img := resources.Get "/images/background.png"}}
|
{{ $img := resources.Get "/images/background.png"}}
|
||||||
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
|
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
|
||||||
"color" "#ffffff"
|
"color" "#ffffff"
|
||||||
@ -61,6 +63,18 @@ The following example will add the text `Hugo rocks!` to the image with the spec
|
|||||||
))}}
|
))}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can load a custom font if needed. Load the font as a Hugo `Resource` and set it as an option:
|
||||||
|
|
||||||
|
```go-html-template
|
||||||
|
|
||||||
|
{{ $font := resources.Get "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
|
||||||
|
{{ $img := resources.Get "/images/background.png"}}
|
||||||
|
{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
|
||||||
|
"font" $font
|
||||||
|
))}}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Brightness
|
### Brightness
|
||||||
|
|
||||||
{{% funcsig %}}
|
{{% funcsig %}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user