Nodes/ComfyUI_agilly1989_motorway/ImageCompositeMasked_motorway_edition
ComfyUI Node

ImageCompositeMasked_motorway_edition

Paste one image onto another with a mask, all inside the pipe

By agilly1989·Created 2 years ago·Updated about a year ago· 7
ImageCompositeMasked_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_destination_keydestination
INPUT_source_keysource
INPUT_mask_keymask
x0
y0
resize_sourcefalse
OUTPUT_IMAGE_keyIMAGE

This is the node you use when you've generated something separately and want to plant it on top of another image - a face back onto a body, an object into a scene, a detail crop stitched back after a high-res pass. ImageCompositeMasked_motorway_edition is stock ComfyUI's ImageCompositeMasked, wrapped for the MOTORWAY 🚌💨 pipe in agilly1989/ComfyUI_agilly1989_motorway.

Where the normal node takes three image/mask wires, this one reads all three out of the pipe by key, composites them, and writes the result back into the pipe. Its only visible output is the Motorway.

Inputs that matter

  • INPUT_destination_key (default "destination") - the base image being pasted onto
  • INPUT_source_key (default "source") - the image being pasted in
  • INPUT_mask_key (default "mask") - controls where the source shows through
  • x and y (INT, 0 to 16384) - where the source lands on the destination
  • resize_source (BOOLEAN, default off) - scale the source to match the destination's size before pasting
  • OUTPUT_IMAGE_key (default "IMAGE") - the composite lands here in the pipe

The resize_source toggle is the one to remember: leave it off and the source is placed at native size, which is what you want for the crop-and-stitch detailer pattern. Turn it on and it stretches the source to fit the destination, which is handy when the two came from different generators.

How it works

Standard clone mechanics: pop the Motorway, pull destination, source and mask out using their key strings, run stock ImageCompositeMasked with x, y and resize_source, store the result under OUTPUT_IMAGE_key, and return a cloned pipe so nothing upstream is touched. The composite pattern pairs well with the pack's mask utilities - grow or feather your mask first if you want the seam to soften.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart ComfyUI, or install via ComfyUI Manager (search "motorway"). Pure Python, no requirements.txt, no downloads.

Gotchas

Keys are exact and case-sensitive; a 'MotorwayClass' object has no attribute 'hash_' error means one of the three keys ("destination", "source", "mask") was never written to the pipe - check what the upstream node actually stored under. Watch the defaults, too: this reads lowercase keys and writes uppercase "IMAGE", so chained clones need matching strings. And the pack's standing health warning applies: it's BETA, and the motorway_edition clone family is disabled in the 1.1.7 hotfix, so if the node's missing from your menu the stock version does the same job with wires.

Categoryagilly1989 Nodes/Motorway-ed/image

Inputs (8)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_destination_keySTRINGdestination
INPUT_source_keySTRINGsource
INPUT_mask_keySTRINGmask
xINT00–16384
yINT00–16384
resize_sourceBOOLEANfalse
OUTPUT_IMAGE_keySTRINGIMAGE

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨