Edit Image+

Edits an image like blur, resize or adding border and text

Overview

The Edit Image+ node in n8n allows you to perform advanced image editing operations on binary image data. Specifically, with the Rotate operation, this node rotates an input image by a specified number of degrees and lets you define the background color for any exposed areas resulting from the rotation. This is useful for tasks such as correcting image orientation, creating artistic effects, or preparing images for further processing.

Practical examples:

  • Automatically rotating scanned documents to the correct orientation.
  • Rotating product images for e-commerce listings.
  • Adjusting user-uploaded profile pictures to match required alignment.

Properties

Below are the supported input properties for the Rotate operation:

Display Name Type Description
Property Name String Name of the binary property in which the image data can be found.
Rotate Number How much the image should be rotated (in degrees, between -360 and 360).
Background Color Color The color to use for the background when the image is rotated by anything not a multiple of 90. Supports alpha channel.
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, or tiff formats (0–100).

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 under the property name specified in "Property Name". The binary object includes:
    • data: The rotated image data (as a buffer).
    • mimeType: MIME type of the output image (e.g., image/png, image/jpeg), based on the selected format.
    • fileExtension: File extension corresponding to the output format.
    • fileName: (Optional) File name if specified in options.

Note:
If the input item already contains other binary properties, they are preserved in the output.

Dependencies

  • External Libraries: Uses GraphicsMagick via the gm npm package for image manipulation.
  • Node.js Modules: Relies on fs, path, and tmp-promise for file handling.
  • n8n Requirements: No special environment variables are needed, but the host system must have GraphicsMagick installed and accessible.

Troubleshooting

Common issues:

  • Missing Binary Data: If the specified "Property Name" does not exist or does not contain valid binary image data, the node will throw an error like No binary data property "..." exists on item!.
    • Resolution: Ensure the input item has the correct binary property with valid image data.
  • Invalid Rotation Value: If the "Rotate" value is outside the allowed range (-360 to 360), the node may fail validation.
    • Resolution: Use a value within the permitted range.
  • Unsupported Format: If an unsupported format is specified in "Options", the output may not be generated correctly.
    • Resolution: Choose one of the supported formats: bmp, gif, jpeg, png, tiff, or webp.
  • GraphicsMagick Not Installed: If the underlying GraphicsMagick tool is missing, image processing will fail.
    • Resolution: Install GraphicsMagick on your server or environment.

Error Handling:

  • If "Continue On Fail" is enabled, errors are reported in the output item's json.error field instead of stopping the workflow.

Links and References

Discussion