Overview
The Edit Image+ node with the Text operation allows you to add custom text onto an image. This is useful for watermarking, labeling, or annotating images within your n8n workflows. For example, you can automatically stamp order numbers on product images, add dynamic captions, or generate personalized graphics.
Common scenarios include:
- Adding watermarks to uploaded images.
- Generating certificates or badges with user names.
- Creating social media images with dynamic text overlays.
Properties
Below are the supported input properties for the Text operation:
Display Name | Type | Description |
---|---|---|
Property Name | String | Name of the binary property in which the image data can be found. |
Text | String | The text to write on the image. Supports multi-line input. |
Font Size | Number | Size of the text to render. |
Font Color | Color | Color of the text (e.g., #000000 for black). |
Position X | Number | X (horizontal) position of the text on the image. |
Position Y | Number | Y (vertical) position of the text on the image. |
Width | Number | Width of the text area. |
Height | Number | Height of the text area. |
Gravity | Options | Text alignment/anchor point. Choices: Center, East, North, NorthEast, NorthWest, South, SouthEast, SouthWest, West. |
Max Line Length | Number | Maximum number of characters per line before a line-break is added. |
Options | Collection | Additional options: - File Name: File name to set in binary data. - Font Name or ID: Font to use (select from list or specify by ID). - Format: Output image format ( bmp , gif , jpeg , png , tiff , webp ).- Quality: Compression level for jpeg/png/tiff (0–100). |
Output
Binary Data:
The output will contain the modified image with the rendered text in the specified binary property (default:data
).- The binary field includes:
data
: The image file as a buffer.mimeType
: MIME type based on selected format (e.g.,image/png
).fileExtension
: File extension (e.g.,png
).fileName
: (Optional) Custom file name if provided.
- The binary field includes:
JSON Data:
The JSON part of the output will mirror the input item's JSON, unless an error occurs (in which case it contains anerror
message).
Dependencies
- External Libraries:
- gm (GraphicsMagick/ImageMagick): Used for image processing.
- get-system-fonts: To list available system fonts.
- tmp-promise: For temporary file handling.
- n8n Requirements:
- The host environment must have GraphicsMagick or ImageMagick installed and accessible.
- No API keys or external services required.
Troubleshooting
Common Issues
Missing Binary Data:
If the specified binary property does not exist or is empty, the node will throw an error like:"No binary data property 'data' exists on item!"
Resolution: Ensure the input item has the correct binary property with valid image data.Invalid Font:
If a non-existent font is specified, the text may not render as expected or may fall back to a default font.Image Format Errors:
If the output format is not supported or the conversion fails, you may see errors related to image encoding.Positioning/Text Overflow:
If the text position or size exceeds the image boundaries, the text may be clipped or not visible.
Error Handling
- If "Continue On Fail" is enabled, errors will be reported in the output item's JSON under the
error
key, and processing will continue for other items.