ImageCompositeBy_BG_Zho
A canvas you already have, positioned by percentage — the most flexible composite here
- container
- images_a
- images_b
- IMAGE
ImageCompositeBy_BG_Zho is the composite node that combines the two nicest ideas from its siblings: you get a container image that defines the canvas (from ImageComposite_BG_Zho) and percentage-based positioning (from ImageCompositeBy_Zho). Feed it a background image plus two images to place, tell it where each should sit as a 0-to-1 fraction, and it hands back a composited IMAGE at the container's resolution. It's the one to grab when your canvas is an actual image in the graph and your layout needs to stay resolution-agnostic.
Same pack, same author (ZHO-ZHO-ZHO), same rules as every node in ComfyUI-Text_Image-Composite: no models, no API keys, pure PIL. It's the least-famous of the four composite variants, which is a shame - for the common "generated background + watermark/logo/text card" case it's arguably the most convenient of the lot, because nothing about the layout is hardcoded in pixels.
How it works
Under the hood it's still the shared base compositor. Your images_a_x/y and images_b_x/y values are floats from 0 to 1, interpreted as a fraction of the leftover space - the room between the image's own size and the container. 0 pins to the left/top edge, 1 pins to the right/bottom, 0.5 centers. The container's dimensions come straight from the container image you wire in.
The alpha_a/alpha_b opacity controls, the background enum (which image is the base layer), and the method enum (pair for equal-length batches composited index-by-index, matrix for every A crossed with every B) are all identical to the base node. One extra guard the other variants don't have: if the container is smaller than the larger of the two images, it raises a ValueError rather than silently clipping everything to mush.
The inputs that matter
container- an IMAGE; its dimensions become the canvas bounds.images_a,images_b- the images to place inside it.images_a_x/y,images_b_x/y- floats 0–1, position as a fraction of the slack.alpha_a,alpha_b- opacity 0–1.background,method- base layer and batch pairing.
Output is a single IMAGE.
Installing it
It ships in the same pack, so one install covers it:
cd ComfyUI/custom_nodes
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-Text_Image-Composite
or use ComfyUI Manager and search ComfyUI-Text_Image-Composite, then restart. There's no requirements.txt and nothing to download; you'll find it under Zho模块组/image in the node menu.
Common issues
The ValueError for an undersized container is the one to know - if your canvas suddenly shrinks, that's this node telling you the background is smaller than what you're trying to place on it. The usual suspects apply too: pair mode needs equal batch lengths, and default-zero positions pile everything into the top-left corner. If a layout needs to survive other people running your workflow at a different resolution, this is the composite node I'd reach for first.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| container | IMAGE | — | |
| images_a | IMAGE | — | |
| images_b | IMAGE | — | |
| alpha_a | FLOAT | 1.000–1 | — |
| alpha_b | FLOAT | 1.000–1 | — |
| images_a_x | FLOAT | 0.00 | — |
| images_a_y | FLOAT | 0.00 | — |
| images_b_x | FLOAT | 0.00 | — |
| images_b_y | FLOAT | 0.00 | — |
| background | COMBO | 2 options: images_a, images_b | |
| method | COMBO | 2 options: pair, matrix |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |