Nodes/Image Processing Suite for ComfyUI/Mask to Image (AnotherUtils)
ComfyUI Node

Mask to Image (AnotherUtils)

Turn a mask into a viewable, savable RGB image

By marcoc2·Created 2 years ago·Updated 5 months ago· 1
Mask to Image (AnotherUtils)
  • mask
  • IMAGE

Mask to Image (AnotherUtils) is a boring converter with a surprisingly common job: it takes a MASK tensor - the [B, H, W] grayscale blob that ComfyUI uses for inpaint regions, alpha, and segmentation - and turns it into a proper three-channel IMAGE. A mask repeated across RGB channels, grayscale in color, ready to preview, save, or feed into any node that demands a normal image tensor.

Why does this node exist when masks are everywhere? Because a huge share of ComfyUI's ecosystem only accepts IMAGE inputs. Save nodes, most preview widgets, upscalers, and a lot of third-party filters simply won't take a mask, so when you want to look at the mask you made, or pass it through an image-only chain, you need the conversion. The mechanism is exactly as literal as it sounds: a [B, H, W] mask becomes [B, H, W, 3] by repeating the single channel three times, and a 2D mask gets its batch dimension restored first. What you get out is a grayscale image where white is "masked," black is "unmasked" - same values, same meaning, just three channels wide now.

The realistic use cases are the small annoyances of real workflows: saving a mask to disk for a sanity check (or to hand to a teammate), feeding a mask through an image-processing chain like the pack's own GIMP-style filters before converting back, or pairing it with the pack's AnotherImageToMask to round-trip a mask through image space. It's also the kind of utility that quietly unblocks you - you don't plan for it, you just hit the wall of "this node won't accept a MASK" and suddenly this is the most important node in the graph.

Gotchas are minor but worth knowing. The mask's value range is passed straight through - a mask in 0–1 floats stays 0–1 floats, which is what ComfyUI expects, so don't expect any 0–255 rescaling magic; if your mask came from somewhere that used a different range, normalize it before this node. And since it's a mechanical channel repeat, there's no smoothing, no colorization, no option to render the mask as a colored overlay - for visual debugging that actually shows the mask region in color, you'd composite elsewhere.

It's one input, one output, zero parameters, zero dependencies. Install: ComfyUI Manager → search "AnotherUtils", or cd ComfyUI/custom_nodes && git clone https://github.com/marcoc2/ComfyUI-AnotherUtils, restart. When you need it, you'll be glad it's a one-line drop-in rather than a build-your-own tensor shuffle.

CategoryAnotherUtils/utils

Inputs (1)

NameTypeDefaultDescription
maskMASK

Outputs (1)

NameTypeDescription
IMAGEIMAGE