Overview
The Edit Image+ node's "Composite" operation allows you to overlay one image on top of another using a variety of blend operators and precise positioning. This is useful for tasks such as watermarking, creating collages, adding logos, or combining multiple images into a single output within your n8n workflows.
Practical examples:
- Adding a company logo to the corner of product images.
- Watermarking photos before publishing.
- Creating composite graphics by layering icons or shapes onto a background image.
Properties
Below are the input properties relevant to the "Composite" operation:
| Display Name | Type | Description |
|---|---|---|
| Property Name | String | Name of the binary property in which the base image data can be found. |
| Composite Image Property | String | The name of the binary property containing the image to overlay on top of the base image. |
| Operator | Options | The operator used to combine the images (e.g., Over, Add, Multiply, etc.). |
| Position X | Number | X (horizontal) position where the composite image will be placed on the base image. |
| Position Y | Number | Y (vertical) position where the composite image will be placed on the base image. |
| Options | Collection | Additional options: - File Name (String): File name to set in binary data. - Format (Options): Output image format (bmp, gif, jpeg, png, tiff, webp). - Quality (Number): Compression level for jpeg/png/tiff formats (0–100). |
Output
- json: Contains the original JSON data from the input item.
- binary:
- The specified binary property (from "Property Name") will contain the resulting composite image.
- Fields include:
data: The image file data (as a buffer).mimeType: MIME type of the output image (e.g.,image/png).fileExtension: File extension based on the selected format.fileName: If provided, the custom file name; otherwise, inherited or generated.
- If the input contained other binary properties, they are preserved unless overwritten.
Note: The node outputs binary image data. No additional metadata about the composition is included in the output JSON.
Dependencies
- External Libraries: Uses GraphicsMagick via the
gmnpm package for image processing. - Node.js Modules: Relies on
fs,path, andtmp-promisefor file handling. - No external API keys required.
- n8n Configuration: Ensure that the n8n instance has access to the necessary system libraries for GraphicsMagick/ImageMagick if running in a restricted environment.
Troubleshooting
Common Issues:
Missing Binary Data:
Error message:"No binary data property '...' exists on item!"
Resolution: Ensure both the base image and the composite image exist in the specified binary properties.Invalid Operator:
Error message: May fail silently or throw an error if an unsupported operator is used.
Resolution: Use only the listed operators in the "Operator" dropdown.Image Format Issues:
Error message: Errors related to unsupported formats or corrupt images.
Resolution: Verify that both images are valid and supported by GraphicsMagick.File System Permissions:
Error message: Errors when writing temporary files.
Resolution: Ensure the n8n process has write permissions to the temp directory.Output Not as Expected:
Issue: Overlay appears in the wrong position or with unexpected blending.
Resolution: Double-check the "Position X", "Position Y", and "Operator" settings.
Links and References
- GraphicsMagick Composite Operators
- n8n Documentation: Working with Binary Data
- n8n Community Support
Tip: Always verify the names of your binary properties and ensure both images are present in the input item before running the composite operation.