Nodes/ComfyUI_agilly1989_motorway/MaskToImage_motorway_edition
ComfyUI Node

MaskToImage_motorway_edition

Turn a mask into an image so you can actually see it

By agilly1989Β·Created 2 years agoΒ·Updated about a year agoΒ· 7
MaskToImage_motorway_edition
  • MOTORWAY πŸšŒπŸ’¨
  • MOTORWAY πŸšŒπŸ’¨
β—„INPUT_mask_keymaskβ–Ί
β—„OUTPUT_IMAGE_keyIMAGEβ–Ί

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 IMAGE to 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 IMAGE and this is the bridge.

The inputs

There are exactly two, which is the whole personality of this node:

  • INPUT_mask_key (default mask) - the key holding the MASK tensor.
  • OUTPUT_IMAGE_key (default IMAGE) - 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_edition nodes may not show up in a fresh install's menu. They're in the 1.1.0–1.1.6 builds comfy.icu indexed.
Categoryagilly1989 Nodes/Motorway-ed/mask

Inputs (3)

NameTypeDefaultDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
INPUT_mask_keySTRINGmaskβ€”
OUTPUT_IMAGE_keySTRINGIMAGEβ€”

Outputs (1)

NameTypeDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”