Round Mask
Turn a soft mask into a clean binary one
- mask
- MASK
Some ops in ComfyUI want a mask with real gradient - feathered edges, partial values, a smooth blend. Others want a hard yes/no cutout and get weird results if you feed them anything in between. Round Mask exists for the second case: it takes a mask (or a batch of them) and rounds every value to the nearest of 0 or 1, collapsing whatever soft, probabilistic, or feathered mask you had into a clean binary one. No parameters, no threshold to tune - it's a one-job node, and the job is exactly what the name says.
Why you'd actually reach for it
The usual trigger is a mask that came out softer than you wanted from somewhere upstream - a blurred detection mask, the result of some blend or composite operation, an amplitude-driven mask from this same pack that's meant to be graded rather than hard-edged. If whatever you're about to feed it into wants a definite in-or-out region - certain compositing or inpainting operations behave oddly with partial mask values, treating "half-masked" pixels in ways that don't match what you'd expect from a clean cutout - run it through this first.
The input and output that matter
There's exactly one of each:
maskin - a mask or batch of masks, any grayscale values.MASKout - the same shape, every value snapped to 0 or 1.
How to install it
Standard KJNodes install: via ComfyUI Manager (search "KJNodes for ComfyUI"), or manually - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, pip install -r ComfyUI-KJNodes/requirements.txt, then restart. Nothing extra for this specific node - it's a tiny, dependency-free operation.
Common issues & troubleshooting
No threshold control means no flexibility on where the cutoff sits. This node rounds at the natural midpoint - there's no widget to move that line. If 0.5 genuinely isn't where you want soft-vs-hard to split, you'll need a different node that exposes an adjustable threshold; this one is fixed by design, which is exactly what makes it simple to reason about.
Feathered edges disappear entirely, which is sometimes a surprise. A softly feathered mask edge - the kind you'd deliberately build for a smooth blend - turns into a hard, slightly jagged boundary after this node, because every value on that gradient gets forced to one side or the other. If you were relying on the feathering for a smooth composite, run this only on the parts of your pipeline that genuinely need a hard cutout, and keep the soft version for anything downstream that's doing blending.
It's a good last step before ops that misbehave on soft masks, and a bad first step if you haven't actually confirmed that's your problem. Before reaching for this, check whether the issue is really "the mask is too soft" versus something else in the pipeline - rounding a mask that wasn't your actual problem just throws away information you might have wanted back.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |