This node takes a batch of images with alpha channels (RGBA format) and combines them into a single image, respecting the transparency of each layer. It's particularly useful for compositing multiple masked elements (like faces) into a single image.
A custom node for ComfyUI that flattens a batch of images with alpha channels into a single image, similar to Photoshop's flatten function.
This node takes a batch of images with alpha channels (RGBA format) and combines them into a single image, respecting the transparency of each layer. It's particularly useful for compositing multiple masked elements (like faces) into a single image.
Clone this repository into your ComfyUI's custom_nodes
directory:
cd ComfyUI/custom_nodes
git clone https://github.com/yourusername/ComfyUI-FlattenByAlpha.git
Restart ComfyUI if it's already running.
black
: Use a black backgroundwhite
: Use a white backgroundtransparent
: Maintain transparency in the outputcustom
: Define a custom RGB color using the color sliderscustom
, adjust the R, G, and B values to create your desired background color.This node is particularly useful for:
The node processes each image in the batch sequentially, blending them together based on their alpha channels. Images later in the batch will appear "on top" of earlier images, similar to how layers work in image editing software.
For transparent backgrounds, the node preserves the alpha channel in the output, allowing for further compositing in downstream nodes.