Nodes/ComfyUI-YCNodes/Image IC Advanced
ComfyUI Node

Image IC Advanced

The in-context combiner with pixel-level control — overlay, XY placement, and the main image on its own

By yichengup·Created 2 years ago·Updated 4 months ago· 47
Image IC Advanced
  • first_image
  • second_image
  • first_mask
  • second_mask
  • IMAGE
  • MASK
  • FIRST_MASK
  • SECOND_MASK
  • MAIN_IMAGE
  • first_size
  • second_size
reference_edgeimage1_width
combine_modehorizontal
second_image_scale1.0
position_typecenter
x_position50.0
y_position50.0
final_size1024
background_color#FFFFFF

ImageICAdvanced is the grown-up version of the pack's ImageIC: same in-context-LoRA / Fill+Redux combining idea, but with the positioning knobs you actually need when "side by side" isn't good enough. It adds an overlay combine mode, precise percentage XY placement, and - the useful one - a separate MAIN_IMAGE output that gives you the reference image alone at the final canvas size, which is exactly what a conditioning stack wants when it needs the reference at full target resolution.

How it works

Like the basic node, it takes two images, anchors the scale on a reference_edge, and builds a shared canvas. The differences are in the placement layer:

  • combine_mode: horizontal / vertical - same seam behavior as ImageIC, but placement along the seam is driven by position_type (top/center/bottom/left/right) instead of a single position option.
  • combine_mode: overlay - the new mode. The second image is placed on top of the canvas at x_position/y_position, given as percentages of the available space (50,50 = center). This is the mode for "put a small subject over a scene," or for in-context work where the reference shouldn't sit flush against an edge.

After compositing, the result is scaled to final_size (long edge) and, in a separate branch, the main image (whichever reference_edge designates) is extracted, re-scaled to fit the same final canvas while keeping its own aspect ratio, and emitted as MAIN_IMAGE on its own. Masks work the same as the basic node: a combined MASK, separate FIRST_MASK / SECOND_MASK region masks, plus first_size / second_size tuples.

The inputs that matter

  • first_image / second_image - the two inputs.
  • reference_edge - image1_width, image1_height, image2_width, image2_height; sets the anchor edge and which image becomes MAIN_IMAGE.
  • combine_mode - horizontal, vertical, or overlay.
  • position_type - top/center/bottom/left/right, used by the seam modes.
  • x_position / y_position - 0–100 percentages, used by overlay mode.
  • second_image_scale - extra scale on image 2, 0.1–2.0.
  • final_size / background_color - target long edge and canvas filler.
  • first_mask / second_mask - optional per-image masks.

Outputs: IMAGE, MASK, FIRST_MASK, SECOND_MASK, MAIN_IMAGE, first_size, second_size.

When you'd pick it over ImageIC

Overlay mode is the headline. In-context partial redraws aren't always "left half / right half" - sometimes the reference belongs floating over a scene, or you want a subject composited at an exact spot, and that's percentage XY placement. And the standalone MAIN_IMAGE output saves you a graph branch: when your pipeline needs the reference at final resolution as well as the combined canvas (common in ICLora conditioning), this node hands you both without you re-scaling anything yourself. If you're just doing simple side-by-side outpainting, the basic node is enough - but the moment you need placement control, this is the one.

Installing it

Part of ComfyUI-YCNodes. ComfyUI Manager → search ComfyUI-YCNodes → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes

Restart, then look under YCNode/Image. Uses opencv-python (as cv2) plus numpy/torch - the pack's requirements.txt covers it.

Gotchas

A few sharp edges. The node takes the first frame of each input batch - single-image oriented, so don't feed it frame batches. x_position/y_position only apply in overlay mode; in the seam modes they're ignored in favor of position_type, and mixing them up produces "why didn't my position do anything" moments. The overlay canvas can get large, and the node does a full-res composite plus a separate main-image render, so on big inputs it's heavier than it looks. And like its sibling, the masks are region masks ("which input owns this pixel"), not transparency weights - treat them as selections, not alpha.

CategoryYCNode/Image

Inputs (12)

NameTypeDefaultDescription
first_imageIMAGE
second_imageIMAGE
reference_edgeCOMBOimage1_width4 options: image1_width, image1_height, image2_width, image2_height
combine_modeCOMBOhorizontal3 options: horizontal, vertical, overlay
second_image_scaleFLOAT1.00.1–2
position_typeCOMBOcenter5 options: top, center, bottom, left, right
x_positionFLOAT50.00–100
y_positionFLOAT50.00–100
final_sizeINT102464–8192
background_colorSTRING#FFFFFF
first_maskoptMASK
second_maskoptMASK

Outputs (7)

NameTypeDescription
IMAGEIMAGE
MASKMASK
FIRST_MASKMASK
SECOND_MASKMASK
MAIN_IMAGEIMAGE
first_sizeTUPLE
second_sizeTUPLE