Overview
The Edit Image+ node's "Draw" operation allows you to draw geometric primitives (Circle, Line, Rectangle) onto an image. This is useful for annotating images, highlighting areas, or programmatically generating graphics. Common scenarios include marking up screenshots, creating diagrams, or adding visual cues to images in automated workflows.
Practical examples:
- Drawing rectangles to highlight detected objects in a photo.
- Adding lines or circles to indicate points of interest on a map image.
- Generating simple graphics for reports or dashboards.
Properties
Below are the supported input properties for the "Draw" operation:
Display Name | Type | Description |
---|---|---|
Property Name | String | Name of the binary property in which the image data can be found. |
Primitive | Options | The primitive to draw: Circle, Line, or Rectangle. |
Color | Color | The color of the primitive to draw (supports alpha channel). |
Start Position X | Number | X (horizontal) start position of the primitive. |
Start Position Y | Number | Y (vertical) start position of the primitive. |
End Position X | Number | X (horizontal) end position of the primitive. |
End Position Y | Number | Y (vertical) end position of the primitive. |
Corner Radius | Number | (Rectangle only) The radius of the corner to create round corners. |
Options | Collection | Additional options: - File Name: Set file name in output - Format: Output image format (bmp, gif, jpeg, png, tiff, webp) - Quality: Compression level for jpeg/png/tiff (0–100) |
Output
- json: Contains the original item JSON data.
- binary: The modified image is returned in the specified binary property (as set by "Property Name").
- The binary field includes:
data
: The image data after drawing the primitive.mimeType
: MIME type based on selected format (e.g.,image/png
).fileExtension
: File extension matching the format.fileName
: If provided, the custom file name; otherwise, inherited or generated.
- The binary field includes:
If the node receives existing binary data, it preserves other binary fields and only updates the specified property.
Dependencies
- External Libraries:
- gm (GraphicsMagick/ImageMagick wrapper)
- tmp-promise (for temporary files)
- get-system-fonts (not used in Draw, but bundled)
- n8n Requirements:
- The n8n instance must have access to the above libraries (usually handled via node installation).
- No API keys required for this operation.
- Environment:
- GraphicsMagick or ImageMagick must be installed on the host system.
Troubleshooting
Common issues:
Missing Binary Data:
Error: "No binary data property '...' exists on item!"
Resolution: Ensure the input item contains the correct binary property as specified in "Property Name".Invalid Coordinates:
Error: The node may fail if coordinates are out of bounds or not numbers.
Resolution: Double-check that all position and size values are within the image dimensions and are valid numbers.Unsupported Format:
Error: "Unknown image format" or similar.
Resolution: Make sure the selected output format is supported and that the host system has the necessary codecs.File Name Issues:
If a file name is provided without an extension, or with a mismatched extension, the node will attempt to correct it.
Resolution: Always specify the desired file extension in the file name or let the node handle it automatically.