LayerStyle

2167
By chflame
Updated 15 days ago
View on GitHub →See Common Issues →

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerMask: ImageToMask

LayerMask: Image To Mask Node Documentation

Overview

The "LayerMask: Image To Mask" node in ComfyUI is designed to convert an input image into a mask using specified image channels and adjustment parameters. This node utilizes various image processing techniques to isolate specific components of an image and adjust their contrast levels, allowing users to create custom masks based on color channels, luminance, or other aspects of an image.

Inputs

The node requires several inputs to function correctly:

  1. Image: The primary input image that will be converted into a mask.

  2. Channel: This specifies which channel of the image to use for the mask creation. Options include:

    • L(Lab)
    • A(Lab)
    • B(Lab)
    • R(RGB)
    • G(RGB)
    • B(RGB)
    • Alpha
    • Y(YUV)
    • U(YUV)
    • V(YUV)
    • H(HSV)
    • S(HSV)
    • V(HSV)
  3. Black Point: An integer value (0 to 255) that sets the black point of the mask; it controls the darkest parts of the mask by setting a threshold.

  4. White Point: An integer value (0 to 255) that sets the white point of the mask; it controls the brightest parts of the mask by setting a threshold.

  5. Gray Point: A floating-point value (0.01 to 9.99) that influences the mid-tone adjustments, effectively altering the gamma and contrast of the mask.

  6. Invert Output Mask: A boolean option to invert the resulting mask, swapping black and white areas.

  7. Mask (Optional): An existing mask to use in conjunction with the generated mask, allowing further customization and composite mask creation.

Outputs

The node produces one primary output:

  • Mask: The resulting mask derived from the specified channel adjustments of the input image. This mask is ready for use in other nodes and functionalities within a ComfyUI workflow.

Usage in ComfyUI Workflows

In ComfyUI workflows, this node acts as a critical component for creating masks from images based on specific channels and image properties. It can be used to:

  • Extract and modify specific color channels for use in further image processing nodes.
  • Develop masks for compositing images, providing region-based effects, or applying localized adjustments.
  • Facilitate complex image operations by converting textures or patterns into masks for advanced control over subsequent nodes.

Special Features and Considerations

  • Channel Selection: The ability to choose between multiple channels such as RGB, LAB, YUV, and HSV allows for sophisticated channel-specific operations, catering to intricate image processing requirements.

  • Flexible Adjustments: With options to set black, white, and gray points, users have granular control over the tonal conversion of images, enabling the creation of precise and targeted masks.

  • Inversion Capability: The option to invert the output mask swiftly modifies the mask output, allowing users to reverse the mask without additional pre or post-processing steps.

  • Optional Mask Input: The feature to incorporate an optional mask provides users with the flexibility to blend existing masks with new ones, offering enhanced compositing possibilities in image workflows.

This node is a versatile tool within ComfyUI, suited for users needing detailed control over mask generation from color and luminance-based image channels. Understanding and utilizing this node effectively can enhance workflow outcomes in image editing and processing tasks.