Specifies a string to be rendered as text over the image.
Tags
Some tags are available to format specific words or sentences inside a text string value:
-
<b>
bold.
-
<i>
italic.
-
<u>
underline.
-
<s>
strikethrough.
-
<sub>
subscript.
-
<sup>
superscript.
-
<tt>
monospace.
You can use text string tags wrapping words and sentences (i.e. <i>Hello</i>
).
Multiline text strings
Multiline text strings can be created adding line feed escape characters \n
to the text string, splitting the text into multiple lines.
An example of a text string value with multiple lines is Line 1\nLine 2\nLine 3
.
This is not required if you are specifying text dimensions with text-width
and text-height
parameters. In that case, text will be splitted on multiple lines automatically.
Text and JPEG
When rendering text using output format
with jpeg
it is possible to find some artifacts due to JPEG compression and differences in contrast between the text and background.
If you feel the resulting image can be improved try to increase quality
to a higher value. For more extreme cases you can even disable chroma subsampling, setting subsample
to 444
at the cost of a bigger file size.
For the following examples we use quality=90
and disabled chroma subsampling with subsample=444
.
Examples
Simple use of text
parameter with text=The five boxing wizards jump quickly.
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=The+five+boxing+wizards+jump+quickly.
Using explicit multiline text string with text=The five boxing\nwizards jump quickly.
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=The+five+boxing%0Awizards+jump+quickly.
Using some tags to modify the previous multiline text string with text=The <s>five boxing</s>\n<i>wizards</i> <b>jump</b> <u>quickly</u>.
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=The+%3Cs%3Efive+boxing%3C%2Fs%3E%0A%3Ci%3Ewizards%3C%2Fi%3E+%3Cb%3Ejump%3C%2Fb%3E+%3Cu%3Equickly%3C%2Fu%3E.
A Japanese text string with text=こんにちは世界
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E4%B8%96%E7%95%8C
In this example we are using emojis as text string value with text=😋🍋🍺🍆
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=%F0%9F%98%8B%F0%9F%8D%8B%F0%9F%8D%BA%F0%9F%8D%86
It's also possible to mix regular text with emojis, here we are using text=Hello World 👋
:
GET
https://assets.imglab-cdn.net/particles.jpeg?text=Hello+World+%F0%9F%91%8B