Nodes/RES4LYF/MaskFloatToBoolean
ComfyUI Node Runs on cloud

MaskFloatToBoolean

Turn a soft, grayscale mask into a hard on/off one

By ClownsharkBatwing·Created 2 years ago·Updated 17 days ago· 1,222
MaskFloatToBoolean
  • mask
  • binary_mask

A one-job utility, and the job is right there in the name. ComfyUI masks are normally soft - every pixel a float between 0 and 1, which is exactly what you want when a mask is being used as a blend weight. But some nodes want a strict binary selection instead: a pixel is either in the mask or it isn't, no in-between. MaskFloatToBoolean converts the first kind into the second.

You'll reach for this specifically when a downstream node is behaving oddly on a soft mask it expects to be binary - a common enough mismatch when masks pass through several processing steps (feathering, edge extraction, resizing) before they hit their final destination.

How it works

Take a mask in, threshold every pixel to either fully on or fully off, and return the result as binary_mask. There's no threshold parameter exposed in the schema, so this is a fixed conversion rather than a tunable one - if you need control over exactly where the cutoff sits, you'd need a different node for that.

The inputs and outputs that matter

  • mask (required, and the only input) - the soft mask you're converting.
  • Output: binary_mask - the same shape, now strictly 0 or 1 per pixel.

How to install it

Via ComfyUI Manager: search "RES4LYF" and install. Manually, from ComfyUI/custom_nodes:

git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt

Activate your venv first if you use one; on portable installs, use python_embedded\Scripts\pip.exe in place of pip. Restart ComfyUI once installed.

Common issues & troubleshooting

You wanted control over the threshold and this node doesn't expose one. That's a real limitation of this particular node - its schema has no cutoff parameter, so it's an all-or-nothing conversion at whatever internal threshold the pack chose. If you need a specific cutoff, look elsewhere in ComfyUI's broader mask-utility ecosystem for a thresholding node with an exposed value.

Feathered edges you built on purpose disappear. That's expected, not a bug - this node's entire job is removing the soft gradient a feathered mask relies on. If you're feeding it a mask you deliberately softened (with MaskEdge, for instance), converting it here throws that softness away. Only run this on masks where a hard boundary is actually what you want.

A downstream node still complains after conversion. Double check it wasn't rejecting the mask for a different reason entirely - resolution mismatch, wrong batch size, or an unconnected required input are all more common causes of a mask being rejected than it simply being soft instead of binary.

You actually wanted the opposite - a mask restricted to just the boundary, not a full binary conversion. That's MaskEdge, RES4LYF's edge-extraction node, which pulls out just the region around a mask's boundary rather than changing every pixel to 0 or 1.

CategoryRES4LYF/masks

Inputs (1)

NameTypeDefaultDescription
maskMASK

Outputs (1)

NameTypeDescription
binary_maskMASK