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

LayerUtility: ImageBlend V2

Documentation: LayerUtility: ImageBlend V2 Node

Overview

The "LayerUtility: ImageBlend V2" node is a blend utility for image manipulation within the ComfyUI framework. It is designed to merge a foreground layer onto a background image using a specified blend mode and opacity setting. This node allows for customizable blending effects between two images, potentially including an optional mask for more controlled blending.

Functionality

  • Blending: Combines a layer_image (foreground) with a background_image using different blend modes determined by the blend_mode parameter.
  • Opacity: Allows users to adjust the transparency of the blend with the opacity input, ranging from fully transparent to fully opaque.
  • Masking: Supports an optional layer_mask that can influence the blending process by defining which parts of the layer image are visible.
  • Invert Mask: Provides an option to invert the layer mask, which can alter how the blend appears.

Inputs

Required Inputs

  • Background Image: The base image onto which the layer image will be blended. It must be provided.

  • Layer Image: The image that will be superimposed onto the background. It must be provided.

  • Invert Mask: A boolean input with a default value of True. This determines whether the optional mask is inverted during processing.

  • Blend Mode: Specifies the method used to blend the images. Various modes can be chosen to achieve different effects.

  • Opacity: An integer input ranging from 0 to 100. This sets the transparency level of the blend, with 0 being fully transparent and 100 being fully opaque.

Optional Inputs

  • Layer Mask: A mask that can fine-tune the blending process by showing or hiding specific areas of the layer image. Its use is optional but provides additional control over the final output.

Outputs

  • Image: The output is a single blended image. The foreground layer is combined with the background, and the blend is influenced by the selected blend mode, mask, and opacity settings.

Usage in ComfyUI Workflows

The LayerUtility: ImageBlend V2 node can be integrated into a ComfyUI workflow where image compositing is required. It is particularly useful in designs that involve layered graphics, artistic compositions, or enhancements where two images need to be merged seamlessly. Workflows may include:

  • Creating visually appealing overlays by adjusting opacity and blend modes.
  • Compositing images with additional textural or visual effects through masks.
  • Photographic editing where one image is used to enhance the background using blend modes.

Special Features and Considerations

  • Batch Processing: The node is capable of processing batches of images concurrently, automatically accommodating the largest batch input.

  • Error Handling: The node includes a basic mechanism for managing mismatches in mask and layer sizes, defaulting to a full-size white mask if discrepancies are found.

  • Performance: As the node leverages PyTorch for tensor operations, it is optimized for high-performance image processing tasks.

  • Flexibility: With customizable blend modes and opacity settings, the node offers significant flexibility in how images are merged, allowing for a wide range of creative outputs.

This node is part of the experimental and utility nodes category (dzNodes/LayerUtility) within ComfyUI, indicating its usefulness for dynamic and diverse image processing applications.