Nodes/was-node-suite-comfyui/Mask Ceiling Region
ComfyUI Node Runs on cloud

Mask Ceiling Region

Isolate the brightest band of a graded mask

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Mask Ceiling Region

      Not every mask is clean black-and-white. A depth map, a saliency output, a CLIPSeg result, or anything that's been through a Gaussian blur carries a gradient of values instead of a hard 0-or-255 split. Mask Ceiling Region is built for exactly that case: per the README, it returns "only white pixels within an offset range" - meaning it looks at the top end of the value range and pulls out just the pixels that are close to fully white, discarding everything dimmer. It's a threshold, but specifically anchored to the ceiling of the range rather than an arbitrary midpoint.

      Why you'd want just the brightest band

      Think of a graded mask as a confidence map: the brightest pixels are the ones the upstream process was most sure about, and everything dimmer is progressively less certain. Sometimes that's fine to keep as-is. Other times you want to be strict - only act on the region the mask is most confident about, and throw away the fuzzy, low-confidence periphery entirely. Ceiling Region gives you that strict cut: keep the near-white core, drop the rest.

      It's also useful as a cleanup step before something that expects a near-binary mask. Feed a hard-edged node a soft gradient and you can get muddy, partial results; Ceiling Region snaps the top of that gradient back into a clean selection first.

      How it works

      It scans the mask's pixel values and keeps only those within an offset band near the top of the range (255), turning that band into the output mask and zeroing everything below it. It has a mirror sibling, Mask Floor Region, which does the same operation anchored at the bottom of the range instead - together they let you carve either end out of a graded mask.

      The inputs and outputs that matter

      A MASK in, and a MASK out containing only the pixels that fell within the offset range near white. On a mask that's already pure binary (only 0 and 255, nothing in between), Ceiling Region has nothing graded to select from and will just return the existing white region roughly unchanged - it earns its keep specifically on soft, gradient masks, not ones that were already hard-edged.

      Installing it

      ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, restart. No model, pure pixel math.

      Common issues & troubleshooting

      The output is empty. If nothing in your mask is actually close to full white, there's nothing for Ceiling Region to select - this is a real property of your input, not a fault in the node. Preview the mask's raw value range first; if the brightest pixel in the whole thing tops out at, say, 180, a band anchored near 255 will legitimately come back blank.

      Result looks identical to the input. That's expected on an already-binary mask - there's no gradient for a ceiling cut to carve out of pure 0/255 data. If you need this to do something visible, run it on a mask that's actually graded (post-blur, post-CLIPSeg, a raw depth map) rather than one that's already threshold-hard.

      The whole pack won't import. Pack-level, not this node. WAS Node Suite has been unmaintained since the author marked it retired in December 2023; the well-known failure mode is the entire suite throwing "Import Failed" after a ComfyUI update because a pinned shared dependency got bumped underneath it. Reinstall requirements.txt against the correct, embedded Python interpreter and restart.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs