Nodes/SaltAI-Open-Resources/Masks to Tensors
ComfyUI Node

Masks to Tensors

Turn a mask into something you can actually look at

By get-salt-AI·Created 2 years ago·Updated 2 years ago· 84
Masks to Tensors
  • masks
  • images

A ComfyUI MASK and a ComfyUI IMAGE are both tensors under the hood, but the type system keeps them strictly separate - you can't wire a mask straight into a node that expects an image, even though a mask is really just a single-channel grayscale picture. SaltMasksToImages is the adapter: it takes a MASK and hands back the same data as an IMAGE, so you can drop it into a Preview Image node to actually see it, a Save Image node to export it as a PNG, or any other node in your graph that only speaks IMAGE.

How it works

It's a format conversion, not a visual transformation - nothing about the mask's content changes. A MASK in ComfyUI is a single-channel (grayscale) float tensor; converting it to IMAGE typically means either keeping it single-channel or replicating that one channel across RGB so standard image nodes handle it without complaint. Either way, what you see is exactly what your mask contained - white where the mask was "on," black where it was "off," gray for anything soft or partial in between.

The inputs and outputs that matter

  • masks (required, MASK) - whatever mask you want to inspect or export.

Output: images (IMAGE) - wire it into Preview Image to look at it mid-graph, Save Image to write it to disk, or any other image-consuming node that needs to treat the mask as a picture rather than a mask.

How to install it

SaltMasksToImages is part of get-salt-AI/SaltAI ("SaltAI-Open-Resources"), from Salt AI (getsalt.ai) - the company that launched in March 2024 running ComfyUI workflows as hosted Discord bots and, later, an API. This is one of the plainest utility nodes in that repo's general-purpose masking family.

Worth knowing before you go looking: github.com/get-salt-AI/SaltAI currently returns a 404. It's not in the org's visible repo list anymore, and it's missing from ComfyUI Manager's index too, so a Manager search or a fresh git clone both come up empty right now. If this specific node is the only thing you need, though, it's easy to live without - several widely-installed general-purpose packs (Impact Pack, WAS Node Suite) ship an equivalent mask-to-image conversion node, and it's a trivial one to write yourself if you're comfortable with a few lines of Python. If SaltAI is already in your environment, nothing here needs attention - no models, no dependency on Salt AI's platform.

Common issues & troubleshooting

The preview looks flat gray instead of black and white. That usually means your source mask itself is mostly mid-value rather than a clean binary mask - this node just shows you what's actually in the mask, so a "gray" preview is telling you the mask itself is soft or ambiguous, not that the conversion did something wrong. Check the mask's source (a soft segmentation output, an un-thresholded blend) rather than this node.

You saved it and the file came out as a single-channel or oddly-formatted image. Depending on how your save node handles single-channel input, you may want to confirm the output looks right in Preview Image before writing to disk - some downstream nodes expect a standard 3-channel RGB image and can behave unexpectedly on a single-channel one.

You actually wanted to go the other direction - image to mask. This node only converts mask-to-image. Turning a regular image (say, its luminance channel) back into a mask is a separate, more common operation that most mask-utility packs, including ComfyUI's own core nodes, already cover - look for an "Image to Mask" node rather than trying to reverse this one.

Nothing downstream changed after swapping this in. If you're replacing a mask-consuming connection with an image-consuming one elsewhere in your graph, double check the receiving node actually expects IMAGE and not MASK - this conversion doesn't make a mask-only node suddenly accept it.

CategorySALT/Masking

Inputs (1)

NameTypeDefaultDescription
masksMASK

Outputs (1)

NameTypeDescription
imagesIMAGE