Nodes/ComfyUI-UniversalToolkit/Color To Mask (UTK)
ComfyUI Node

Color To Mask (UTK)

Converts chosen RGB value to a mask based on color distance. The node calculates the Euclidean distance between each pixel's color and the target RGB color. Pixels within the threshold distance are included in the mask (white), while others are excluded (black). With batch inputs, the **per_batch** parameter controls the number of images processed at once for memory efficiency. Parameters: - RGB values: Target color to match (0-255) - Threshold: Maximum color distance for inclusion (0-255) - Invert: Flip the mask (exclude matching colors instead) - Per batch: Number of images to process simultaneously

By whmc76·Created about a year ago·Updated 24 days ago· 70
Color To Mask (UTK)
  • images
  • mask
red0
green0
blue0
threshold10
invertfalse
per_batch16
CategoryUniversalToolkit/Tools

Inputs (7)

NameTypeDefaultDescription
imagesIMAGEInput images to convert to masks
redINT00–255Red component of target color
greenINT00–255Green component of target color
blueINT00–255Blue component of target color
thresholdINT100–255Maximum color distance for inclusion in mask
invertBOOLEANfalseInvert the mask (exclude matching colors)
per_batchINT161–4096Number of images to process simultaneously

Outputs (1)

NameTypeDescription
maskMASK