ImageToMask_motorway_edition
Pull one channel out of an image and use it as a mask
- MOTORWAY ππ¨
- MOTORWAY ππ¨
Masks are just grayscale images under the hood, which means a lot of them can be stolen from an image you already have: the alpha channel of a PNG with transparency, the red channel of a painted overlay, the luminance of a black-and-white silhouette. ImageToMask extracts one channel and hands it to you as a mask. ImageToMask_motorway_edition is the same node reading from and writing to a MOTORWAY ππ¨ pipe.
It's part of agilly1989/ComfyUI_agilly1989_motorway, the author's key-value pipe pack. It reads the image out of the pipe under INPUT_image_key (default "image"), pulls out the channel you pick, and stores the mask back under OUTPUT_MASK_key (default "MASK"). Only visible output is the Motorway pipe.
Inputs that matter
INPUT_image_key(default"image") - pipe key of the sourcechannel-red,green,blue, oralphaOUTPUT_MASK_key(default"MASK") - where the mask lands
The channel choice is the whole job. alpha is the common one: a PNG with transparency becomes a cutout mask in one step. The RGB channels are for when you've painted or rendered something where one channel carries the shape you want. Whatever you pick, you get a single-channel mask at the image's dimensions, ready to feed into mask plumbing - including this pack's GrowMask_motorway_edition if you want to expand or soften it before use.
How it works
Standard clone mechanics: pop the Motorway, pull the image out via the input key, run stock ImageToMask with your channel, store the result under the output key, and return a cloned pipe so nothing upstream is mutated. Note the direction: this is image-to-mask. The pack's ImageColorToMask is the sibling that matches a specific solid color instead of a channel.
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 model downloads.
Gotchas
Keys are exact and case-sensitive; a 'MotorwayClass' object has no attribute 'hash_' error means your key string matches nothing in the pipe. Mind the case default - you read "image" (lowercase) and write "MASK" (uppercase) - so a chain of clones needs keys you set to agree. And the family status: BETA, with the motorway_edition clones disabled in the 1.1.7 hotfix - if the node's missing from your menu, stock ImageToMask is the same tool with wires.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_image_key | STRING | image | β |
| channel | COMBO | 4 options: red, green, blue, alpha | |
| OUTPUT_MASK_key | STRING | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |