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

LayerMask: PixelSpread Node Documentation

Overview

The LayerMask: PixelSpread node is a component of the ComfyUI Library designed to manipulate images with the use of masks. This node allows users to apply pixel spreading effects to an image, an operation that involves expanding areas of similar pixel values. The process is guided by an optional mask, which can be inverted, grown or reduced in size.

Node Functionality

What This Node Does

The LayerMask: PixelSpread node processes images by applying a pixel spread operation. This involves altering the image based on the mask provided, which dictates the areas of the image that are subject to changes. If no mask is provided, the node defaults to the alpha channel of the image (if available) or uses a white mask otherwise.

Inputs

The node requires the following inputs:

  • Image: The primary image on which the pixel spread effect will be applied. This is a required input.

  • Invert Mask: A boolean option that, when true, inverts the mask before applying it to the image. This is an optional feature and defaults to False.

  • Mask Grow: An integer value that determines how much the mask should be grown or shrunk before applying it to the image. Positive values will grow or expand the mask, while negative values will shrink it. This parameter defaults to 0, indicating no change in the mask size.

  • Mask: An optional input that allows for the use of a custom mask, separate from the default mask derived from the image's alpha channel.

Outputs

The node generates the following outputs:

  • Image: The processed image after applying the pixel spread effect. The output image retains the same dimensions as the input image.

Usage in ComfyUI Workflows

In a typical ComfyUI workflow, the LayerMask: PixelSpread node can be used in scenarios where specific regions of an image need to be highlighted, blurred, or altered while leaving other regions unchanged. This can be particularly useful in creative design workflows, image editing, and preprocessing tasks.

Application Examples

  • Image Enhancement: Automatically enhance areas of an image while keeping other regions intact to bring focus to certain features.

  • Creative Effects: Apply artistic effects selectively across an image for creative design purposes.

  • Image Preprocessing: Prepare images for further processing by selectively spreading pixels in specific regions.

Special Features and Considerations

  • Dynamic Mask Application: This node supports both automatic mask extraction from images with alpha channels and the use of custom masks, providing flexibility in image processing tasks.

  • Adjustable Mask Growth: The mask growth feature allows for fine-tuning of the affected regions, enabling precise control over the pixel spread effect.

  • Error Handling: The node includes error checking to ensure that the mask and image dimensions match, preventing potential errors due to size mismatches.

Conclusion

The LayerMask: PixelSpread node is a versatile tool within the ComfyUI framework, offering flexible and powerful options for image manipulation using masks. By understanding its inputs, outputs, and potential use cases, users can effectively integrate this node into their workflows for creative and practical applications.