LayerStyle
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
Available Nodes
LayerUtility: CheckMask
LayerUtility: Check Mask Node Documentation
Overview
The "LayerUtility: Check Mask" node is a component used in ComfyUI workflows to determine the validity of a mask image. This node inspects a given mask and checks whether a significant portion of it is above a specified brightness level. If the area of the mask with brightness above this level exceeds a specified percentage of the entire mask, the mask is considered valid.
Inputs
This node requires the following inputs:
-
Mask
- Type: MASK
- Description: The mask image that needs to be validated. This mask should be provided in a format supported by ComfyUI as a MASK input type.
-
White Point
- Type: Integer
- Range: 1 to 254
- Default: 1
- Description: This parameter defines a threshold for brightness. Any pixel in the mask with a brightness value higher than this threshold is considered to be part of the "white area." This contrast setting helps in evaluating which parts of the mask are substantial in terms of color intensity.
-
Area Percent
- Type: Integer
- Range: 1 to 99
- Default: 1
- Description: This parameter specifies the minimum percentage of the mask that needs to be above the specified white point to consider the mask valid. If the percentage of the mask exceeding the white point threshold is lower than this value, the mask is marked as invalid.
Output
The node produces the following output:
- Boolean
- Type: BOOLEAN
- Name: "bool"
- Description: This output is a simple boolean value. It returns
trueif the mask is considered valid according to the specified criteria (white point and area percent); otherwise, it returnsfalse.
Usage
In a ComfyUI workflow, the "LayerUtility: Check Mask" node is used to verify the effectiveness and validity of a mask before proceeding with further processing steps. This can be particularly useful in image editing, compositing, or any other use case where mask integrity is critical.
Here’s a typical use case scenario:
-
Mask Validation: Before applying complex transformations or effects to an image using a mask, you'll want to ensure that the mask is significantly bright according to your specifications.
-
Workflow Decision-Making: Use the boolean output to make decisions within your workflow. For example, if the mask is valid, proceed with certain operations; if not, apply an alternative process or notify the user.
Special Features and Considerations
-
Rescaling for Large Masks: For masks that are particularly large (i.e., those with dimensions resulting in a pixel count greater than 262,144), the node automatically resizes them to a width of 512 pixels while maintaining aspect ratio. This resizing ensures efficient processing and avoids potential issues related to memory consumption for very large images.
-
Performance Optimization: The node uses specific image processing techniques (e.g., thresholding and area calculation) optimized for performance in determining mask validity, making it suitable for real-time or high-volume processing tasks.
In summary, the "LayerUtility: Check Mask" node provides a robust utility for workflows that require high confidence in mask integrity, allowing for more streamlined and efficient image editing or processing operations within ComfyUI.