ComfyUI Node

ImageCompositeBy_Zho

Percentage positioning for your composites

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

ImageCompositeBy_Zho is the version of ImageComposite_Zho you want when your layouts have to survive a resolution change. The "By" is the giveaway: your positions are percentages, not pixels. Where the base node makes you type images_a_x: 320 and hope your canvas is still 1024 wide later, this one lets you say "A sits at 25% across, B at 75%" and it recomputes the pixels for whatever size you're actually running. If you build workflows you share with other people - who will absolutely run them at a different resolution than you did - that's a genuinely useful property.

It's part of ZHO-ZHO-ZHO's ComfyUI-Text_Image-Composite pack. Same author, same no-frills README, same "no models, no keys, pure PIL" deal. It's a thin wrapper around the base compositor, so once you know ImageComposite_Zho, this one takes about a minute to learn.

How it works

The node still composites via PIL alpha blending, but it derives both the canvas size and the offsets for you.

Each images_a_x/y and images_b_x/y is a float from 0 to 1 - interpreted as a fraction of the slack, the space left over after the image's own size is subtracted from the container. So 0 pins the image to the left/top edge, 1 pins it to the right/bottom edge, and 0.5 centers it. That's the neat trick: your position stays meaningful no matter what resolution you run at.

The canvas size comes from container_size_type, with four options:

  • max - canvas is the largest of the two images' dimensions. Good default.
  • sum - width and height both added together.
  • sum_width - side-by-side layout: same height, widths summed. Raises a ValueError if the heights differ.
  • sum_height - stacked layout in theory. Fair warning: in the source this mode has a bug (it doubles image A's height rather than adding A and B, and its validation checks the wrong variable), so treat sum_height as experimental and stick with max or sum for real work.

Then the same background and method enums as the base node: which image is the base layer, and pair (equal-length batches, index-by-index) vs matrix (all A×B combinations).

The inputs that matter

  • images_a, images_b - the two image batches.
  • images_a_x/y, images_b_x/y - floats 0–1, position as a fraction of the remaining space.
  • container_size_type - max, sum, sum_width, sum_height.
  • alpha_a, alpha_b - opacity 0–1.
  • background, method - base layer and pairing mode.

Output is a single IMAGE.

Installing it

ComfyUI Manager → search ComfyUI-Text_Image-Composite, or manually:

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

Restart. No requirements.txt, nothing to pip-install, no models to download. You'll find it under Zho模块组/image.

Common issues

The pair-batch ValueError and the both-at-zero-offset default apply exactly as in the base node. The one thing unique to this variant is the sum_height bug mentioned above - if a stacked layout is your actual goal, either use sum and an offset, or wire in the BG variant with a container image of the size you want. For resolution-independent overlays and centered layouts, this is the variant you'll want in your default workflow.

CategoryZho模块组/image

Inputs (11)

NameTypeDefaultDescription
images_aIMAGE
images_bIMAGE
alpha_aFLOAT1.000–1
alpha_bFLOAT1.000–1
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