Skip to main content

Composite Image

Controlled node

Overview

The Composite Image node overlays one image onto another at a specified position. This is useful for adding watermarks, logos, annotations, or combining multiple images into a single composition. The node takes a base image and overlays a source image at the specified X and Y coordinates.

Image Processing

This node is part of the image processing suite and requires a valid Jimp image object as input. Use the Read Image node or AI Generate Image node to create compatible image inputs.

Inputs

InputTypeDescriptionDefault
RunEventTriggers the node to execute.-
ImageDataThe base image to composite onto. Must be a valid Jimp image object.-
SrcDataThe source image to overlay on top of the base image. Must be a valid Jimp image object.-
XNumberThe horizontal position (in pixels) where the top-left corner of the source image will be placed.0
YNumberThe vertical position (in pixels) where the top-left corner of the source image will be placed.0

Outputs

OutputTypeDescription
DoneEventFires when the image compositing is complete.
OutputDataThe resulting composite image (Jimp object). Returns null if inputs are invalid.

Runtime Behavior and Defaults

When the Composite Image node runs, it first clones the base image to preserve the original. It then composites the source image (src) onto the base image at the specified coordinates (x, y).

  • Coordinate System: The X and Y coordinates represent the top-left corner of the source image relative to the top-left corner of the base image (0,0).
  • Blending: The source image is placed on top of the base image using standard alpha compositing. Transparent areas in the source image will allow the base image to show through.
  • Bounds: The source image can be positioned partially or fully outside the bounds of the base image. Only the overlapping region will be visible in the output.
  • Error Handling: If either the image or src inputs are not valid Jimp image objects, the node outputs null.

Example Usage

Adding a Watermark

Connect an image loaded via Read Image to the image input, and a logo or watermark image to the src input. Set x and y to position the watermark (e.g., bottom-right corner):

X: {{image.width - watermark.width - 20}}
Y: {{image.height - watermark.height - 20}}

Creating a Collage

Use multiple Composite Image nodes in sequence to layer several images together. For example:

  1. First node: Composite a background image with a photo at (0, 0)
  2. Second node: Take the output and composite another photo at (200, 0)
  3. Third node: Take the output and composite a border or frame

Dynamic Positioning

Use the Image Size node to get dimensions of the base image, then use a Formula node to calculate centered positions:

X: (baseWidth - overlayWidth) / 2
Y: (baseHeight - overlayHeight) / 2