ImageColorToMask_motorway_edition
Turn a solid color into a mask, no wires touched
- MOTORWAY ππ¨
- MOTORWAY ππ¨
Sometimes the fastest way to get a mask is to have an image where the thing you want masked is basically one flat color - a chroma background, a solid backdrop, a flat fill. ImageColorToMask turns exactly that into a mask. ImageColorToMask_motorway_edition is the same node with its input and output routed through the MOTORWAY ππ¨ pipe in agilly1989/ComfyUI_agilly1989_motorway.
It reads the image out of the pipe under INPUT_image_key (default "image"), finds the pixels that match color, and stores the resulting mask back into the pipe under OUTPUT_MASK_key (default "MASK"). Output is the Motorway pipe only - the mask is waiting in the pipe for whatever reads that key next.
Inputs that matter
INPUT_image_key(default"image") - pipe key of the source imagecolor(INT, 0 to 16777215, default 0) - the RGB value as a packed integer.0is black,16777215is white, and pure green is0x00FF00= 65280OUTPUT_MASK_key(default"MASK") - where the mask lands
That packed-integer color is the field beginners trip over, because it's not a friendly hex picker. The math is red*65536 + green*256 + blue, so a pure red is 16711680 and a pure blue is 255. If your target isn't a clean match, the mask will come out spotty - this node is honest about exact color, it does no tolerance fuzzing.
How it works
The wrapper is the standard clone pattern: pop the Motorway, pull the image via the input key, call stock ImageColorToMask with color, store the mask under the output key, and return a cloned pipe. The resulting mask feeds naturally into mask utilities - including the pack's own GrowMask_motorway_edition if you want to expand it a few pixels so the edge blends.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI, or search "motorway" in ComfyUI Manager. No requirements.txt, no model downloads - pure Python.
Gotchas
Same pack-wide caveats: keys are exact and case-sensitive (hash_ errors mean your key string matches nothing in the pipe), the defaults read lowercase ("image") and write uppercase ("MASK") so chained clones need hand-aligned keys, and the motorway_edition family is the pack's experimental clone feature, disabled in the 1.1.7 hotfix - if it's not in your menu, stock ImageColorToMask is the same node with wires. And if your colors aren't perfectly flat, don't fight it - that's what feathering and a GrowMask shrink are for.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_image_key | STRING | image | β |
| color | INT | 00β16777215 | β |
| OUTPUT_MASK_key | STRING | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |