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

Documentation for LayerUtility: ImageCombineAlpha Node

Overview

The LayerUtility: ImageCombineAlpha node is a part of the ComfyUI_LayerStyle repository. It is designed to process images by combining an RGB image with a separate mask to produce an RGBA image. This node is particularly useful in scenarios where you need to overlay or composite images with transparency, allowing for more versatile image manipulation within the ComfyUI framework.

What This Node Does

The ImageCombineAlpha node takes an RGB image and a mask and merges them together to produce an RGBA image. The RGB image provides the color data, while the mask is used to determine the alpha channel (transparency). This enables creating images with varying levels of transparency based on the mask, providing more control over how images are combined and displayed.

Inputs

The node accepts the following inputs:

  1. RGB_image: This input is for one or more RGB images. The RGB format consists of three color channels: Red, Green, and Blue.

  2. mask: This input is for a corresponding mask image that determines the alpha channel. The mask should ideally be in grayscale, where different shades of gray represent varying levels of transparency (alpha).

Outputs

The node produces one output:

  1. RGBA_image: This output is the result of combining the RGB image with the mask to form an RGBA image. The additional A (alpha) channel is derived from the mask, which controls the transparency of the image.

Usage in ComfyUI Workflows

In ComfyUI workflows, the ImageCombineAlpha node can be used in various contexts involving image composition and layering. Here are a few ways it can be utilized:

  • Image Compositing: When creating composite images, this node allows users to overlay one image over another, controlling the transparency through the alpha channel defined by the mask.
  • Special Effects: Users can create effects like fading, blending, or masking parts of an image based on the alpha transparency.
  • Image Editing: In photo editing workflows, this node can be used to apply selective transparency to parts of an image, aiding in tasks like background removal or creating transparent overlays.

Special Features or Considerations

  • Batch Processing: The node is capable of processing inputs in batches, which means multiple images and masks can be processed in one go, streamlining workflows that require handling numerous files.
  • Channel Compatibility: It supports different channel modes (e.g., RGBA, YCbCr, LAB, HSV), although this node specifically operates in the RGBA mode for combining images.
  • Mask Handling: Ensure that the mask input used for the alpha channel is prepared properly. Masks should ideally be single-channel grayscale images for accurate transparency application.

The LayerUtility: ImageCombineAlpha node thus enhances the image manipulation capabilities in ComfyUI by allowing intricate control over image transparency and composition.