Visit ComfyUI Online for ready-to-use ComfyUI environment
Convert specified RGB color in image to mask, isolate colors, define target color, threshold, invert mask, batch processing.
The ColorToMask
node is designed to convert a specified RGB color value within an image into a mask. This is particularly useful for isolating specific colors in an image and creating masks that can be used for further image processing or artistic effects. The node allows you to define the target color and a threshold to determine how closely colors in the image must match the target color to be included in the mask. Additionally, you can choose to invert the mask, turning the selected color areas into the background and vice versa. The node also supports batch processing, enabling you to handle multiple images simultaneously, with the per_batch
parameter controlling the number of images processed at once.
This parameter accepts the input images that you want to process. The images should be in a format that the node can interpret, typically as tensors.
This boolean parameter determines whether the mask should be inverted. If set to True
, the areas matching the target color will be turned into the background, and the rest of the image will become the mask. The default value is False
.
This integer parameter specifies the red component of the target RGB color. It ranges from 0 to 255, with a default value of 0.
This integer parameter specifies the green component of the target RGB color. It ranges from 0 to 255, with a default value of 0.
This integer parameter specifies the blue component of the target RGB color. It ranges from 0 to 255, with a default value of 0.
This integer parameter defines the tolerance level for color matching. Colors within this threshold distance from the target color will be included in the mask. It ranges from 0 to 255, with a default value of 10.
This integer parameter controls the number of images processed at once in batch mode. It ranges from 1 to 4096, with a default value of 16.
The output is a mask where the areas matching the specified RGB color (within the given threshold) are highlighted. The mask is a tensor with values clamped between 0.0 and 1.0, representing the masked areas.
red
, green
, and blue
parameters to the desired RGB values and adjust the threshold
to fine-tune the mask.invert
parameter to quickly switch between highlighting the target color and the rest of the image.per_batch
parameter to optimize performance based on your system's capabilities.threshold
parameter is set to a value outside the acceptable range of 0 to 255. - Solution: Adjust the threshold
parameter to a value within the specified range.per_batch
parameter is set to a value higher than the maximum allowed limit of 4096.per_batch
parameter to a value within the acceptable range of 1 to 4096.© Copyright 2024 RunComfy. All Rights Reserved.