Documentation: LayerMask: Shadow & Highlight Mask Node
Overview
The "LayerMask: Shadow & Highlight Mask" node is a powerful tool within the ComfyUI framework that allows users to create specialized masks based on shadow and highlight levels within an image. This node is particularly useful for advanced image editing, layer compositing, and creating visual effects where precise control over these aspects is necessary.
What This Node Does
This node processes input images to generate two distinct masks:
- Shadow Mask: Identifies and isolates areas in the image that are shadows based on specified levels and ranges.
- Highlight Mask: Identifies and isolates areas in the image that are highlights based on specified levels and ranges.
These masks can be applied in image processing workflows to apply further edits or effects selectively to shadowed or highlighted areas.
Inputs
The node accepts the following inputs:
Required Inputs
- Image: The input image(s) that will be processed to generate the shadow and highlight masks.
- Shadow Level Offset: An integer value that offsets the baseline shadow level detection threshold. Accepts values from -99 to 99 with a default value of 0. This modifies the sensitivity and range of shadow detection within the image.
- Shadow Range: A float value defining the range of luminance considered as shadow, with constraints between 0.01 and 0.99. The default is 0.25. Adjusting this changes the breadth of shadow tones captured in the mask.
- Highlight Level Offset: An integer value that offsets the baseline highlight level detection threshold. Accepts values from -99 to 99 with a default value of 0. This parameter similarly modifies the sensitivity and range of highlight detection.
- Highlight Range: A float value defining the range of luminance considered as highlight, with constraints between 0.01 and 0.99. The default is 0.25. Adjusting this changes the breadth of highlight tones captured in the mask.
Optional Input
- Mask: An optional pre-existing mask that can further refine the areas of the image to be processed. This input allows users to specify parts of the image to include or exclude from shadow and highlight detection.
Outputs
The node produces two main outputs:
- Shadow Mask: A mask image that highlights the areas determined to be shadows within the input image.
- Highlight Mask: A mask image that highlights the areas determined to be highlights within the input image.
Both outputs allow for further manipulation or integration into broader workflows.
Usage in ComfyUI Workflows
In a typical ComfyUI workflow, the "LayerMask: Shadow & Highlight Mask" node can be used to:
- Enhance Images: By isolating shadow and highlight regions, users can apply distinct effects, such as exposure adjustments, color grading, or filtering, to specific parts of an image.
- Compositing Layers: Create complex compositions by blending different elements using the dynamically generated masks, ensuring that edits or overlays are naturally integrated based on the image's lighting composition.
- Selective Editing: Target specific components of an image for enhancement or attenuation, allowing for precise control over the final output.
- Visual Effects: In digital art and visual effects creation, the generation of accurate shadow and highlight masks can support the synthesis of more realistic composites or stylized outcomes.
Special Features and Considerations
- Dynamic Thresholds: The ability to adjust shadow and highlight level offsets and ranges gives users granular control over the node's behavior, making it adaptable to various scenarios and artistic intent.
- Batch Processing: Since the node can handle multiple images at once, it is suitable for workflows involving bulk image processing.
- Mask Integration: Optional mask integration allows for a high degree of customization, enabling users to constrain mask creation to predefined areas of interest.
- Image Type Flexibility: The node supports images of various types and modes, ensuring robust compatibility across different image inputs.
In summary, the "LayerMask: Shadow & Highlight Mask" node in ComfyUI is a versatile asset for users looking to manipulate and refine images based on luminance characteristics, particularly shadows and highlights. It offers significant flexibility and customization options to suit diverse creative needs and technical requirements.