Overview
The Edit Image+ node for n8n allows you to perform advanced image editing operations directly within your workflows. Specifically, when using the Transparent operation on the Default resource, this node makes a specified color in an input image transparent. This is useful for tasks such as removing backgrounds, preparing images for overlays, or cleaning up scanned documents.
Practical examples:
- Removing a solid background color from product photos.
- Making white backgrounds transparent for logos before placing them on colored surfaces.
- Preparing images for further compositing or web use where transparency is required.
Properties
Below are the relevant input properties for the Default resource and Transparent operation:
Display Name | Type | Description |
---|---|---|
Property Name | String | Name of the binary property in which the image data can be found. |
Color | Color | The color in the image that should be made transparent (e.g., #ff0000 ). |
Options | Collection | Additional options for output formatting and file naming. |
Options collection fields:
- File Name (String): File name to set in the output binary data.
- Format (Options: bmp, gif, jpeg, png, tiff, webp): Set the output image format. Default is
jpeg
. - Quality (Number, 0–100): Sets the compression level for jpeg/png/tiff formats (higher is better quality).
Output
The node outputs an item with the following structure:
- json: Contains the original JSON data from the input item.
- binary: Contains the processed image data under the property name specified by "Property Name".
- data: The edited image as a binary buffer.
- mimeType: MIME type of the output image (e.g.,
image/png
). - fileExtension: File extension based on the selected format (e.g.,
png
). - fileName: (Optional) Custom file name if provided.
Note: The node outputs binary data representing the image with the specified color made transparent.
Dependencies
- External Libraries:
- gm (GraphicsMagick/ImageMagick wrapper)
- tmp-promise (for temporary files)
- get-system-fonts (not used in Transparent operation)
- n8n Requirements:
- The host system must have GraphicsMagick or ImageMagick installed and accessible.
- No API keys or external service credentials are required for this operation.
Troubleshooting
Common issues:
- Missing Binary Data: If the specified "Property Name" does not exist in the input item's binary data, the node will throw an error like
No binary data property "..." exists on item!
. Ensure the correct property name is used and that the input contains image data. - Invalid Color Format: If the color value is not a valid hex code or recognized color string, the operation may fail or produce unexpected results.
- Unsupported Format: If you select an output format not supported by your system's GraphicsMagick/ImageMagick installation, the node may fail with a conversion error.
- Image Processing Errors: Corrupted or unsupported input images may cause errors during processing.
How to resolve:
- Double-check the "Property Name" matches the key in your input item's binary data.
- Use standard hex color codes (e.g.,
#ffffff
) for the "Color" property. - Make sure GraphicsMagick or ImageMagick is properly installed on your server/machine.
- Try converting the image to a supported format before processing if you encounter format errors.