A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
The "LayerMask: MaskGrow" node is part of the ComfyUI LayerStyle extension, designed to manipulate image masks within a ComfyUI workflow. This node enables users to adjust and enhance the structure of masks by inverting them, growing their size, and applying a blur effect. Such manipulations are essential in image processing tasks where precise control over mask boundaries is required, such as in compositional editing, selective filtering, or layer blending.
The "LayerMask: MaskGrow" node accepts the following inputs:
mask: This input accepts a "MASK" type, which represents the binary or grayscale mask that you wish to process. The mask should define the regions of interest within an image that require modification.
invert_mask: This is a boolean input with a default value of True
. When enabled, the input mask is inverted, flipping its black and white regions. This can be useful when you want to switch the areas of focus and background.
grow: An integer value input with a default value of 4
. It determines how much the mask should expand or contract. Positive values will grow the mask outward, while negative values will shrink it inward. The value can be adjusted between -999 and 999 in steps of 1.
blur: An integer value input with a default value of 4
. This determines the level of blur applied to the expanded or contracted mask. The blur effect smoothens the mask's edges, ensuring a more natural transition. The blur range is from 0 to 999.
This node does not have optional inputs.
The "LayerMask: MaskGrow" node produces the following output:
In ComfyUI workflows, the "LayerMask: MaskGrow" node serves as a tool for refining and manipulating masks. It can be used in various scenarios, such as:
Layer Composition: Modifying masks to achieve more precise layer compositions by expanding or contracting areas.
Selective Effects: Preparing masks for selective application of image effects, filtering, or adjustments.
Mask Refinement: Smoothing or enhancing mask edges for more natural-looking edits.
To use this node effectively, you would typically integrate it at a point in your workflow where mask manipulation is necessary. Feed a mask into the node, adjust the "invert_mask", "grow", and "blur" parameters as needed, and then use the output mask in subsequent processing steps or nodes.
Inversion: The ability to invert the mask provides flexibility in deciding which areas of the image to target versus which to exclude.
Adjustable Growth: The growth parameter offers a versatile range for modifying the mask size, accommodating different levels of refinement.
Edge Smoothing: The built-in blur functionality ensures smoother transitions at the edges of masks, enhancing the visual quality of masked areas.
By incorporating these capabilities, the "LayerMask: MaskGrow" node empowers users with greater control over mask-based image modifications in their ComfyUI projects.