IC LoRA Concat (RMBG) 🖼️🎭
Lay an object beside a base image for in-context editing
- object_image
- object_mask
- base_image
- base_mask
- IMAGE
- OBJECT_MASK
- BASE_MASK
- WIDTH
- HEIGHT
- X
- Y
IC-LoRA - in-context LoRA - is the trick where you put two images side by side on one canvas and let the model treat one as a reference and the other as the thing to generate, so the output inherits the reference's style, object, or identity. It's a big, current technique in the Flux era; you'll see it all over Kontext and in-context editing workflows. This node builds the concatenated canvas that those workflows need, and tracks where each piece landed so you can pull the result back apart afterward.
The manual version of this is annoying: paste an object image next to a base image, remember the exact pixel offset, generate, then crop the output back at that same offset. Get the bookkeeping wrong and your crop is misaligned. IC LoRA Concat does the layout and returns the coordinates, so the round-trip is exact.
How it works
You give it an object image (and optionally a base image), it lays them out in the chosen orientation, and it returns the combined canvas plus the geometry: width, height, and the X/Y where the object was placed. It also passes through masks for both halves. The whole design is round-trip-aware - it hands you back everything you need to composite the generated result exactly where the object was.
The inputs and outputs that matter
object_image(required) - the reference object you're placing.base_image(optional) - the base canvas it sits beside. Without it, the node still lays out the object for a single-image in-context setup.layout-left-rightortop-bottom. Which way the two images concatenate. Match this to what your in-context LoRA or Kontext workflow expects.custom_size- force a specific canvas dimension instead of deriving it from the inputs. Leave at 0 to auto-size.object_mask/base_mask(optional) - masks for each half, carried through so masked in-context editing stays aligned.
Outputs: IMAGE (the concatenated canvas), OBJECT_MASK and BASE_MASK (the masks positioned on the combined canvas), WIDTH, HEIGHT, and crucially X and Y - the object's placement offset. Those two ints are how you crop the generated result back out cleanly.
How to install it
- ComfyUI Manager: search
Comfyui-RMBG, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, thenpip install -r requirements.txt, and restart.
Pure layout math, no model - but like the other Kontext-adjacent nodes, it's only meaningful inside an in-context / Kontext workflow with the right model doing the actual generation.
Common issues
The failure people hit is a misaligned crop at the end - you generated on the concatenated canvas, then cropped the wrong region back out. Don't eyeball it: use the X, Y, WIDTH, and HEIGHT outputs to drive your crop, and the round-trip lines up. The other one is layout mismatch: if your workflow was built expecting the reference on the left and you set top-bottom, the model reads the canvas wrong and the effect breaks. Match the layout to the workflow you're plugging into, and make sure the model downstream actually does in-context editing - this node just builds the canvas, it can't teach a plain model to read a reference.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| object_image | IMAGE | The main image to be used as the foreground (object) in the concatenation. If the image has 4 channels (RGBA), the alpha channel will be automatically extracted and used as the object mask if no mask is provided. | |
| layout | COMBO | left-right | The direction in which to concatenate the images: top-bottom or left-right. |
| custom_size | INT | 00–16384 | If 0, the output image size is unchanged. Otherwise, sets the base image height (for left-right) or base image width (for top-bottom) in pixels for the concatenation. The object image will be scaled proportionally to match the base image in the concatenation direction. |
| object_maskopt | MASK | Mask for the object_image. Defines the region of the object_image to be blended into the base_image. | |
| base_imageopt | IMAGE | The background image to be concatenated with the object_image. If the image has 4 channels (RGBA), the alpha channel will be automatically extracted and used as the base mask if no mask is provided. | |
| base_maskopt | MASK | Mask for the base_image. Defines the region of the base_image to be blended with the object_image. |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| OBJECT_MASK | MASK | — |
| BASE_MASK | MASK | — |
| WIDTH | INT | — |
| HEIGHT | INT | — |
| X | INT | — |
| Y | INT | — |