LatentConcat
Stitch two latents together — the mechanism behind Kontext-style editing
- samples1
- samples2
- LATENT
LatentConcat takes two latents and joins them end-to-end along a chosen axis. It sounds like plumbing, but it's the mechanical heart of a whole family of tricks, from Flux Kontext-style editing (where you literally concatenate a reference image into the model's context) to extending a video latent in time. If you've ever wondered how "the model sees the reference and the generation simultaneously" works - this is one of the ways.
How it works
You feed samples1 and samples2 plus a dim, and it concatenates along that dimension. The dimension options are the full set: x, -x, y, -y, t, -t. The letter is the axis (x = width, y = height, t = time/frames); the sign controls which sample comes first. Positive puts samples1 first, negative puts samples2 first.
One automatic step worth knowing about: samples2 gets resized to samples1's batch size first (repeat_to_batch_size). So if you're stitching a single reference latent onto a batch of generations, it repeats the reference to match - the node is forgiving about batch mismatch.
Where people actually use it
- Context-window editing. Concatenating a reference latent onto the input is how several modern editing pipelines let the model condition on an existing image structurally instead of via adapter weights. That's the Flux Kontext approach, and it's why it holds a subject across edits where IP-Adapter-style injection drifts.
- Extending video in time. Concat along
tto glue frame sequences end to end before a sampler continues them. - Panoramas and panels. Stitch side by side along
xoryto build wide compositions, then sample over the joined latent.
What matters in practice
The dimension letter is the one thing you can't get wrong silently - concat along the wrong axis gives you a tensor the sampler will choke on or silently reinterpret. And because you're joining, not blending, the two latents need compatible shapes on every axis except the one you're joining along. x-stitch needs matching heights and channels; t-stitch needs matching spatial size. If you're joining a video latent to a still, resize the still's spatial dims first.
Output is a single LATENT, ready for the sampler or a further transform.
Gotchas
Spatial concat makes the image wider or taller, but the model was trained on specific resolutions - a 1024-wide latent stitched to 2048 is asking the model to work at a resolution it may handle poorly. For Kontext-style use that's the point (the model is trained to consume the reference), but for ad-hoc stitching expect the sampler to need guidance. And keep the channel counts aligned: concat across a mismatched channel count produces garbage, not an error. The sign of the dim is the one genuinely confusing bit - remember positive means "samples1 leads."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples1 | LATENT | — | |
| samples2 | LATENT | — | |
| dim | COMBO | 6 options: x, -x, y, -y, t, -t |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |