# text2image: Convert Texts to an Image

> text2image (Convert Texts to an Image) is a 1001fx API function in the group Images: POST https://api.1001fx.com/images/text2image, 3 credits per item. It works as a ready-made module in Make and n8n or as a plain HTTP call.

Converts multiple texts on a colored background and creates an image. Transparent backgrounds allow overlay on another image.

- Group: Images
- Endpoint: `POST https://api.1001fx.com/images/text2image`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 3 credits per item
- Ready-made in: Make and n8n
- Docs: https://1001fx.com/functions/text2image

## Parameters

- `backgroundColor` (string (HEX Color), optional) – Background color: The image background color. Transparent if empty.
- `width` (number, required, min 1, max 10000) – Width: The image width.
- `height` (number, required, min 1, max 10000) – Height: The image height.
- `data` (array<object>, required) – Texts: Data to be displayed
  - `text` (string, required) – Text: The text to print.
  - `x` (number, required) – X coordinate: The x position from the top left corner.
  - `y` (number, required) – Y coordinate: The y position from the top left corner.
  - `maxWidth` (number, required, min 1) – Maximum width: The maximum width of your textarea.
  - `maxHeight` (number, required, min 1) – Maximum height: The maximum height of your textarea.
  - `alignmentX` (enum, optional, one of `left`, `center`, `right`, default `left`) – Horizontal alignment: Horizontal text alignment. Defaults to 'left'.
  - `alignmentY` (enum, optional, one of `top`, `middle`, `bottom`, default `top`) – Vertical alignment: Vertical text alignment. Defaults to 'top'.
  - `fontSize` (enum, optional, one of `8`, `16`, `32`, `64`, `128`, `auto`, default `auto`) – Font size: Fontsize of your text. Default to 'auto'.
  - `textColor` (string (HEX Color), required, default `#000000`) – Text color: The text color. Defaults to '#000000'.

## Example: Print text on custom background

```bash
curl -X POST 'https://api.1001fx.com/images/text2image' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"height":1000,"width":1000,"backgroundColor":"#000000","data":[{"text":"Alice","x":0,"y":0,"maxWidth":500,"maxHeight":400,"textColor":"#fff123"},{"text":"Bob","x":0,"y":200,"maxWidth":500,"maxHeight":400,"textColor":"#fff123"}]}'
```
