LatentCompositeMasked_motorway_edition
Paste a latent onto a latent, constrained by a mask
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
LatentCompositeMasked_motorway_edition wraps the masked sibling of LatentComposite: it pastes a source latent onto a destination latent, but only inside the region defined by a mask - and it can resize the source to fit first. The motorway edition pulls all three inputs (destination, source, mask) out of pipe keys and stores the result back under a key.
The mask is the point
Plain LatentComposite is a rectangular paste; this node is the one you reach for when the region you want to fill isn't a rectangle. The mask is what decides where the source lands - think patching a face region, filling an irregular inpaint zone, or compositing a person back into a scene where a hard box would clip them. The workflow pattern is the same as all latent compositing: do the placement in latent space, then let a sampling pass blend the seam so the boundary disappears.
Two inputs matter beyond the three keys:
x/y(step 8, default 0) - placement position in latent coordinates, not pixels. Latents are 8x smaller per side, so a 512px offset is 64 here; the step of 8 is a hint that these are latent-space values.resize_source(default false) - when on, the source latent is resized to match the mask's bounding box before compositing. Turn it on when your source piece is a different size than the hole you're filling - off, and mismatched sizes either paste partially or error out.
The key fields are INPUT_destination_key ("destination"), INPUT_source_key ("source"), and INPUT_mask_key ("mask"); the output is OUTPUT_LATENT_key (default "LATENT"). Destination is the canvas, source is the piece, mask is the stencil. If you've done masked compositing in pixels, nothing here is new - it's the same mental model one layer of abstraction down.
Motorway notes
Every input is a key field, so all three values must exist in the pipe before this node runs. The only output socket is MOTORWAY 🚌💨; read the result out via a Motorway AxB ramp to sample or decode it. And the standard failure mode applies: a missing or mistyped key throws 'MotorwayClass' object has no attribute 'hash_' - with three keys feeding in, that's usually a mismatch between the mask's key and what your masker actually wrote.
Install and reality check
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI, or install via ComfyUI Manager. No pip deps, no models.
The pack-wide caveats: one-developer beta, README-frank about breakage, and the current repo HEAD has the _motorway_edition registration commented out mid-refactor - so a fresh clone may not show this node at all. The KB's inpainting guidance is the reason you'd use masked latent compositing in the first place (blend the region in latent space before sampling, don't just paste pixels), but none of that changes the recommendation for the wrapper: if masked compositing is the only motorway-ed node in your graph, the stock LatentCompositeMasked does the identical job with sockets and fewer moving parts.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_destination_key | STRING | destination | — |
| INPUT_source_key | STRING | source | — |
| INPUT_mask_key | STRING | mask | — |
| x | INT | 00–16384 | — |
| y | INT | 00–16384 | — |
| resize_source | BOOLEAN | false | — |
| OUTPUT_LATENT_key | STRING | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |