Round Mask(RoundMask)
This node technically accepts a MASK-type tensor as input and performs the `round()` function operation on each pixel value within it.
Round Mask
The Round Mask node technically receives a tensor of type MASK as input and performs a round() function operation on each pixel value within it.
The Round Mask node is a utility tool for processing masks. Its core function is to convert an input grayscale mask or batch of masks into a binary mask containing only black and white values through rounding. This operation effectively simplifies masks with intermediate grayscale values into clear mask data containing only 0s and 1s.
Node Functionality
This node technically receives a tensor of type MASK as input and performs a round() function operation on each pixel value within it. Regardless of whether the input mask's pixel values are continuous floating-point numbers (e.g., 0.3, 0.7) or other values, after processing, all values greater than or equal to 0.5 are approximated to 1 (white/foreground), and all values less than 0.5 are approximated to 0 (black/background). It supports processing a single mask or a batch of masks, outputting a binary MASK with the same dimensions as the input.
Node Parameter Description - Round Mask
Inputs
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
mask | MASK | Yes | - | - | - |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| MASK | MASK | - |
Usage Scenarios
In image generation or editing workflows, when you need to extract precise object contours from a blurry mask with feathered edges (e.g., a mask generated by a SAM segmentation model), you can use this node. Connecting it downstream from a mask generation node allows you to quickly obtain a hard-edged mask for subsequent precise matting, local inpainting, or as an input condition for other image processing nodes.
Round Mask Node Source Code Link
The Round Mask node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.