Image IC
Stitch two images into one canvas for in-context LoRA work
- first_image
- second_image
- first_mask
- second_mask
- IMAGE
- MASK
- FIRST_MASK
- SECOND_MASK
- first_size
- second_size
If you've seen the Flux "in-context" workflows, you know the pattern: put a reference image on the left half of a canvas, leave the right half blank, and let the model outpaint the right side using the left as context. It's how people do one-shot consistent outpainting and partial redraws without a full re-generation - and it's exactly the workflow where two random images need to be glued onto one canvas at a matching scale, with masks that say which half is real. ImageIC is that glue. It's a two-image combination node built specifically for in-context LoRA and Flux Fill+Redux partial redraw pipelines.
How it works
You give it two images, and it stitches them horizontally or vertically onto a shared canvas. The clever part is how they're sized. reference_edge declares which image's edge is the anchor - say image1_width - and the other image is scaled so its corresponding edge matches that dimension, giving you a seamless shared dimension down the seam. second_image_scale fine-tunes the second image on top of that, and second_image_position (top/center/bottom/left/right) places it against the first. final_size then scales the whole combined canvas to a target long-edge length, and background_color fills any leftover canvas.
The node also tracks regions, not just pixels: it outputs a combined MASK plus separate FIRST_MASK and SECOND_MASK (which parts of the canvas belong to each input) and two size tuples for downstream math. Feed those masks to an inpaint/conditioning stack and the model knows exactly what's reference and what's blank to invent.
The inputs that matter
- first_image / second_image - the two inputs.
- reference_edge -
image1_width,image1_height,image2_width,image2_height; which edge anchors the scale. This is the knob that makes the seam line up. - combine_mode -
horizontalorvertical. - second_image_scale - 0.1–2.0, on top of the anchor matching.
- second_image_position - top/center/bottom/left/right placement against the first image.
- final_size - target long edge, 64–8192, step 64.
- background_color - canvas filler.
- first_mask / second_mask - optional per-image masks.
Outputs: IMAGE, MASK, FIRST_MASK, SECOND_MASK, first_size, second_size.
Why this node exists
The pack README says it outright: these combination nodes exist to "save the size of Flux iclora and Fill+redux when partial redrawing" - i.e., don't regenerate the whole image, combine the existing part with a blank and let the model only work the blank. The source is a rework of lrzjason/Comfyui-In-Context-Lora-Utils by the pack author, so if you've seen that earlier tool, this is its updated form. For Flux ICLora specifically: reference on the left, masked-blank on the right, outpaint the right side - and the masks this node emits are what make that clean instead of guesswork.
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. Requires opencv-python (imported as cv2) plus numpy/torch - all in the pack's requirements.txt.
Gotchas
The inputs are single-image oriented: it takes the first frame of each batch tensor, so don't feed it video batches and expect per-frame stitching. The reference_edge behavior means the second image is resampled to match - if you wanted it untouched, set second_image_scale and pick the anchor that least distorts it. And the masks are region masks, not per-pixel alpha of transparency: they say "this pixel belongs to image 1" as a white value, so treat them as selection regions, not blend weights.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| first_image | IMAGE | — | |
| second_image | IMAGE | — | |
| reference_edge | COMBO | image1_width | 4 options: image1_width, image1_height, image2_width, image2_height |
| combine_mode | COMBO | horizontal | 2 options: horizontal, vertical |
| second_image_scale | FLOAT | 1.00.1–2 | — |
| second_image_position | COMBO | center | 5 options: top, center, bottom, left, right |
| final_size | INT | 102464–8192 | — |
| background_color | STRING | #FFFFFF | — |
| first_maskopt | MASK | — | |
| second_maskopt | MASK | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| FIRST_MASK | MASK | — |
| SECOND_MASK | MASK | — |
| first_size | TUPLE | — |
| second_size | TUPLE | — |