ComfyUI > Nodes > comfyui-tensorop > GetLayerMask

ComfyUI Node: GetLayerMask

Class Name

GetLayerMask

Category
tensorops
Author
un-seen (Account age: 1647days)
Extension
comfyui-tensorop
Latest Updated
2024-10-26
Github Stars
0.03K

How to Install comfyui-tensorop

Install this extension via the ComfyUI Manager by searching for comfyui-tensorop
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfyui-tensorop in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

GetLayerMask Description

Extract color layers and text masks from images for precise editing and manipulation.

GetLayerMask:

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.

GetLayerMask Input Parameters:

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.

json_data

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.

GetLayerMask Output Parameters:

MASK

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.

MASK

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.

JSON

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.

GetLayerMask Usage Tips:

  • Ensure that the input image is of high quality and resolution to improve the accuracy of the color and text masks generated by the node.
  • When preparing the JSON data for text masks, double-check the coordinates and labels to ensure they accurately represent the text areas in the image.
  • Use the generated masks to apply effects or transformations to specific parts of the image without affecting other areas, enhancing your creative control over the image editing process.

GetLayerMask Common Errors and Solutions:

Invalid image format

  • Explanation: The input image is not in a supported format or is corrupted.
  • Solution: Ensure the image is a valid PIL image and is not corrupted. Convert the image to a supported format if necessary.

Malformed JSON data

  • Explanation: The JSON data provided is not correctly formatted or lacks necessary information.
  • Solution: Verify that the JSON data is correctly structured and includes all required fields, such as polygon coordinates and labels.

No unique colors found

  • Explanation: The image does not contain any unique colors that can be isolated into masks.
  • Solution: Check the image to ensure it contains distinct colors. If the image is monochrome or has very subtle color variations, consider adjusting the image to enhance color differences.

GetLayerMask Related Nodes

Go back to the extension to check out more related nodes.
comfyui-tensorop
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

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.