Images API

Text String text

Specifies a string to be rendered as text over the image.


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.


Simple use of text parameter with text=The five boxing wizards jump quickly.:

Rendering text over image with text parameter.
x px

Using explicit multiline text string with text=The five boxing\nwizards jump quickly.:

Rendering multiline text over image with text parameter including line feed escape characters.
x px

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>.:

Rendering multiline text with tags over image with text parameter.
x px

A Japanese text string with text=こんにちは世界:

Rendering japanese text over image with text parameter.
x px

In this example we are using emojis as text string value with text=😋🍋🍺🍆:

Rendering emojis text over image with text parameter.
x px

It's also possible to mix regular text with emojis, here we are using text=Hello World 👋:

Rendering mixed regular text and emojis with text parameter.
x px