ComfyUI Node

ImageComposite_BG_Zho

Same compositor, but the canvas comes from an image you already have

By ZHO-ZHO-ZHO·Created 3 years ago·Updated 2 years ago· 123
ImageComposite_BG_Zho
  • container
  • images_a
  • images_b
  • IMAGE
alpha_a1.00
alpha_b1.00
images_a_x0
images_a_y0
images_b_x0
images_b_y0
background
method

ImageComposite_BG_Zho is ImageComposite_Zho with one input swapped: instead of typing in container_width and container_height, you wire in a container image and the canvas takes its exact dimensions. If you look at the source, it doesn't even reimplement anything - it reads the container's height and width and hands them to the base node. This is the compositing node you want when the background already exists as an image in your graph.

That's a common situation. You've rendered a background, or you made one with the pack's RGB_Image_Zho solid-color node, and now you want to drop something on top of it at a specific spot. The BG variant lets you keep that "canvas" as a first-class part of the pipeline instead of hardcoding pixel dimensions that go stale the moment you change your resolution.

How it works

Everything else is identical to ImageComposite_Zho. You get two images, images_a and images_b, each with an alpha_a/alpha_b opacity from 0 to 1 and integer pixel offsets (images_a_x, images_a_y, images_b_x, images_b_y). The background enum decides which image is the base layer, and method picks between pair (same-length batches, composited index-by-index) and matrix (every A crossed with every B, which grows your batch into a grid).

The difference is only in how the canvas is sized: the container IMAGE's own width and height. Whatever you feed it defines the bounds, and anything that spills past the edge gets clipped.

The inputs that matter

  • container - an IMAGE whose dimensions become the canvas. This is the whole point of the node.
  • images_a, images_b - the two images to place inside it.
  • alpha_a, alpha_b - 0 to 1 opacity for each.
  • images_a_x/y, images_b_x/y - pixel offsets from the canvas top-left.
  • background, method - base layer and batch pairing mode.

Output is a single IMAGE at the container's resolution.

Installing it

Same pack, same install as the rest of ComfyUI-Text_Image-Composite. ComfyUI Manager search, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-Text_Image-Composite

Restart and it appears under Zho模块组/image. No requirements.txt, no model downloads, no extra deps beyond what ComfyUI already has.

Common issues

The failure modes are inherited from the base node. pair mode throws a ValueError if the two batches aren't the same length. Both offsets default to 0, so both images stack at the top-left corner - give the top layer an offset or it'll sit invisibly under the other. And don't expect per-pixel masks here; the alphas are flat values. If your goal is "background image + something composited on it, at the background's resolution," this is the cleanest of the four composite variants - it's the one to reach for when a canvas image already exists in your graph.

CategoryZho模块组/image

Inputs (11)

NameTypeDefaultDescription
containerIMAGE
images_aIMAGE
images_bIMAGE
alpha_aFLOAT1.000–1
alpha_bFLOAT1.000–1
images_a_xINT0
images_a_yINT0
images_b_xINT0
images_b_yINT0
backgroundCOMBO2 options: images_a, images_b
methodCOMBO2 options: pair, matrix

Outputs (1)

NameTypeDescription
IMAGEIMAGE