Nodes/Allor Plugin/ImageCompositeRelative
ComfyUI Node

ImageCompositeRelative

Center or corner-pin images with percentages, not pixels

By Nourepide·Created 3 years ago·Updated 2 years ago· 295
ImageCompositeRelative
  • images_a
  • images_b
  • IMAGE
images_a_x0.00
images_a_y0.00
images_b_x0.00
images_b_y0.00
background
container_size_type
method

Pixel offsets are great until you change the canvas size and every element is suddenly in the wrong place. ImageCompositeRelative is the responsive sibling of ImageCompositeAbsolute: instead of typing pixel numbers, you place each image with a 0–1 percentage, and the node converts that to pixels based on the container and image sizes at runtime. It's the node that survives resolution changes without you touching a thing.

How it works

For each image the offset is computed as (container_size - image_size) × percent. Read that as "fraction of the leftover space": 0 pins the image flush to the top-left, 1 pins it flush to the bottom-right, and 0.5 centers it - in both X and Y, independently. So images_a_x = 0.5 with images_a_y = 0.5 is "center image A," and images_b_x = 1 with images_b_y = 1 is "image B in the bottom-right corner," regardless of what the sizes actually are.

The canvas itself is defined by container_size_type:

  • max - the largest width and largest height of the two images (what ImageContainerInheritanceMax builds).
  • sum - both widths and both heights added.
  • sum_width - side-by-side sizing (widths add).
  • sum_height - stacked sizing (heights add).

One flag worth knowing: in the current source, the sum_height branch adds height_a twice rather than height_a + height_b. It's a real quirk, and if your stacked layout comes out a frame taller than it should be, that's why - treat that mode with suspicion and check the output size.

The background input picks which image is the base layer, and method is the usual pair / matrix batch behavior.

Why you'd use it

Any layout you want to be self-adjusting: a centered watermark, a corner badge, a two-up comparison that needs to work at any generation resolution. Because the percentages resolve against real sizes, you can build the workflow once and swap in bigger images later. Same RGBA and edge-cropping notes as the rest of the family - output is transparent where nothing is placed, and extreme placements can crop.

Installing Allor

Part of the Allor Plugin (Nourepide/ComfyUI-Allor), ~90 nodes from early 2024. Install once:

cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor
cd ComfyUI-Allor
pip install -r requirements.txt

Restart, or search "Allor Plugin" in ComfyUI Manager - more reliable given the pack's history of manual-install import errors (reinstall via Manager was the repeated fix in early Reddit threads). Dependencies are rembg + onnx; this node needs no models.

Gotchas that apply to the whole pack

The repo was rebased to strip images from history (shrank ~344×), which can break git pull/auto-update - the README's update-troubleshooting docs have the fix; delete-and-reclone is the blunt one. [Allor] console lines at startup are the pack writing config.json and checking updates, not an error.

Categoryimage/composite

Inputs (9)

NameTypeDefaultDescription
images_aIMAGE
images_bIMAGE
images_a_xFLOAT0.00
images_a_yFLOAT0.00
images_b_xFLOAT0.00
images_b_yFLOAT0.00
backgroundCOMBO2 options: images_a, images_b
container_size_typeCOMBO4 options: max, sum, sum_width, sum_height
methodCOMBO2 options: pair, matrix

Outputs (1)

NameTypeDescription
IMAGEIMAGE