Visit ComfyUI Online for ready-to-use ComfyUI environment
Extract color layers and text masks from images for precise editing and manipulation.
The GetLayerMask
node is designed to process images and extract distinct color layers and text masks from them. This node is particularly useful for AI artists who need to manipulate or analyze images by isolating specific color regions and text areas. By converting an image into a series of masks, it allows for more precise editing and manipulation of individual elements within the image. The node identifies unique colors in an image, creates masks for each color, and also processes text data to generate corresponding masks. This functionality is beneficial for tasks that require detailed image segmentation, such as creating layered compositions or applying effects to specific parts of an image.
The image
parameter expects an input of type IMAGE
. This parameter is crucial as it provides the source image from which the color and text masks will be extracted. The image should be in a format that can be processed by the node, typically a PIL image. The quality and resolution of the input image can significantly impact the accuracy and detail of the generated masks.
The json_data
parameter is of type JSON
and contains information about text elements within the image. This data should include details such as the coordinates of text polygons and their labels. The JSON data is used to create masks for text areas, allowing for the isolation and manipulation of text within the image. Properly formatted JSON data is essential for accurate text mask generation.
The first MASK
output represents the background mask of the image. This mask is a binary representation where the background is isolated from other elements, allowing for easy manipulation or replacement of the background in image editing tasks.
The second MASK
output consists of the masks for the individual color layers extracted from the image. Each mask corresponds to a unique color found in the image, enabling selective editing or analysis of specific color regions.
The JSON
output provides a list of text labels associated with the text masks generated from the input JSON data. This output is useful for understanding which text areas correspond to which labels, facilitating tasks that involve text recognition or annotation.
RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.