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: MaskEdgeShrink

LayerMask: MaskEdgeShrink Node Documentation

Overview

The LayerMask: MaskEdgeShrink node is a component of the ComfyUI library designed for manipulating image masks. This node primarily focuses on shrinking the edges of masks with customizable parameters to achieve various effects, such as creating smoother transitions or adjusting mask boundaries. It provides users with the ability to refine and control the appearance of their image masks in creative projects.

What This Node Does

The LayerMask: MaskEdgeShrink node processes an input mask to shrink its edges. It applies a combination of inversion, expansion, color stepping, and edge reserving techniques to alter the visual characteristics of the mask. The node allows for detailed control over mask manipulation, making it a powerful tool for graphic designers and developers working with layered or composite images.

Inputs

  1. Mask

    • Type: Mask
    • Description: The primary image mask to be processed. This mask provides the base upon which all operations are applied.
  2. Invert Mask

    • Type: Boolean
    • Default: True
    • Description: Determines whether the input mask should be inverted before processing. Inversion can alter the initial mask's interpretation (i.e., swapping foreground and background).
  3. Shrink Level

    • Type: Integer
    • Default: 4
    • Range: 0 to 16
    • Description: Controls the degree of shrinkage applied to the mask's edge. Higher values result in more significant shrinkage.
  4. Soft

    • Type: Integer
    • Default: 6
    • Range: 0 to 64
    • Description: Determines the softness or glow applied to the edge during the shrinking process. Higher values yield a softer transition.
  5. Edge Shrink

    • Type: Integer
    • Default: 1
    • Range: 0 to 999
    • Description: Specifies the number of pixels to shrink the edge inward. This parameter controls the specific size reduction of the mask's edge.
  6. Edge Reserve

    • Type: Integer
    • Default: 25
    • Range: 0 to 100
    • Description: Adjusts the transparency of the reserved edge after shrinking. Higher values increase opacity.

Outputs

  • Mask
    • Type: Mask
    • Description: The processed mask with the applied edge shrink effect, ready for further processing or integration into a project.

Usage in ComfyUI Workflows

In ComfyUI, the LayerMask: MaskEdgeShrink node can be utilized to refine and manipulate masks as part of a larger image processing pipeline. It is particularly useful in scenarios where precise control over mask edges is required, such as in composite image creation, automated graphic generation, or advanced photo editing. By integrating this node, users can improve mask transitions, emphasize specific parts of an image, or prepare masks for further compositing operations.

Special Features or Considerations

  • Versatility: The node offers a range of customizable options, enabling users to fine-tune their mask processing needs.
  • Inversion Capability: The ability to invert masks before processing provides flexibility in dealing with various types of input masks.
  • Control Over Softness and Shrinkage: Users can precisely define the softness and shrink level, allowing for a wide variety of artistic effects.
  • Edge Reserve Transparency: The node allows for managing the transparency of the resulting edge, giving more creative control over the final output.
  • Performance: Ensure that your environment has adequate processing capabilities, as complex operations over large images or multiple masks may be computationally intensive.

By leveraging the LayerMask: MaskEdgeShrink node, users can significantly enhance their image processing workflows and achieve professional-quality results with detailed control over mask edges.