MaskToImage_motorway_edition
Turn a mask into an image so you can actually see it
- MOTORWAY ππ¨
- MOTORWAY ππ¨
Masks are single-channel tensors. Images are three-channel. Most of the time you don't care - you're wiring mask into mask-consuming nodes and the shapes line up. But the moment you want to preview a mask, composite it onto a real image, or hand it to something that insists on an IMAGE, you need a conversion. That's this node: the Motorway-ed clone of ComfyUI's MaskToImage, and one of the simplest nodes in the whole pack.
What it does
It takes a MASK from the Motorway, replicates the single channel across three to make a grayscale RGB image, and writes the result back under an IMAGE key. White stays white, black stays black, and every shade of grey in between becomes an RGB shade of grey. There's no thresholding, no color, no cleverness - a mask in, a greyscale image out.
That makes it the go-to when you want to:
- See what a mask actually looks like by routing the resulting
IMAGEto a preview node (everyone hits this the first time they chain edge detection or a keyer). - Composite the mask onto a canvas in image space, or save it as a normal PNG for inspection.
- Feed an image-space consumer that doesn't accept masks - some ControlNet-ish and compositing paths want an
IMAGEand this is the bridge.
The inputs
There are exactly two, which is the whole personality of this node:
INPUT_mask_key(defaultmask) - the key holding theMASKtensor.OUTPUT_IMAGE_key(defaultIMAGE) - where the converted image lands.
The MOTORWAY ππ¨ in/out is the standard wrapper plumbing. Everything else - the built-in behavior, the channel replication - is identical to stock MaskToImage; the clone just reads by key and writes by key instead of using wires.
Install
Same as every node in the pack - one install covers all Motorway-ed clones. ComfyUI Manager, search "ComfyUI_agilly1989_motorway", or:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI. No requirements.txt, no model downloads, no extra Python.
Troubleshooting
'MotorwayClass' object has no attribute 'hash_'means the mask key doesn't exist in the Motorway - the producer probably hasn't run yet, or the key spelling differs (case-sensitive).- Don't expect a nice RGB-colored mask. You get greyscale, which is the honest rendering of what the mask is. If you want the mask as color for compositing, that's a different tool.
- Pack caveats apply: it's BETA, and the newest published version (1.1.7) temporarily disabled the clone generation, so these
_motorway_editionnodes may not show up in a fresh install's menu. They're in the 1.1.0β1.1.6 builds comfy.icu indexed.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_mask_key | STRING | mask | β |
| OUTPUT_IMAGE_key | STRING | IMAGE | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |