ComfyUI > Nodes > DJZ-Nodes > Batch Alpha Composite

ComfyUI Node: Batch Alpha Composite

Class Name

BatchAlphaComposite

Category
image/processing
Author
DriftJohnson (Account age: 4052days)
Extension
DJZ-Nodes
Latest Updated
2025-04-25
Github Stars
0.04K

How to Install DJZ-Nodes

Install this extension via the ComfyUI Manager by searching for DJZ-Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter DJZ-Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Batch Alpha Composite Description

Efficiently blend image batches with transparency using alpha compositing for seamless overlay effects.

Batch Alpha Composite:

The BatchAlphaComposite node is designed to perform alpha compositing on batches of images, allowing you to blend two sets of images seamlessly. This node is particularly useful in scenarios where you need to overlay images with transparency, such as adding effects or combining multiple image layers. By leveraging the alpha channel, which represents the transparency level of each pixel, the node effectively merges the top image layer (with transparency) onto the bottom image layer. This process is done in batches, making it efficient for handling multiple images simultaneously. The node ensures that the compositing is done accurately by converting image data between different formats and applying the necessary mathematical operations to achieve the desired visual effect. This capability is essential for creating complex image compositions in digital art and design.

Batch Alpha Composite Input Parameters:

bottom_images

The bottom_images parameter represents the batch of images that will serve as the base layer in the compositing process. These images are expected to be in RGB format, meaning they contain three color channels (Red, Green, and Blue) and should be provided as a torch tensor with a shape of (B, H, W, 3), where B is the batch size, H is the height, and W is the width of the images. The values in this tensor should be normalized to the range [0, 1]. This parameter is crucial as it determines the background over which the top images will be composited.

top_images

The top_images parameter is the batch of images that will be overlaid on the bottom images. These images must include an alpha channel, making them RGBA format, with four channels (Red, Green, Blue, and Alpha). The alpha channel controls the transparency of each pixel, allowing for smooth blending with the bottom images. This parameter should be provided as a torch tensor with a shape of (B, H, W, 4), where B is the batch size, H is the height, and W is the width of the images. Like the bottom images, the values should be normalized to the range [0, 1]. The top_images parameter is essential for defining the visual elements that will be composited onto the base layer.

Batch Alpha Composite Output Parameters:

IMAGE

The output of the BatchAlphaComposite node is a batch of composited images, returned as a torch tensor. This tensor has the same shape as the bottom_images input, (B, H, W, 3), and contains the final RGB images after the alpha compositing process. Each output image is the result of blending the corresponding top image onto the bottom image using the alpha channel to determine transparency levels. This output is crucial for obtaining the final visual result of the compositing operation, allowing you to see the combined effect of the two input image batches.

Batch Alpha Composite Usage Tips:

  • Ensure that both bottom_images and top_images are correctly formatted and normalized to the range [0, 1] to avoid unexpected results during compositing.
  • Use this node when you need to overlay images with transparency, such as adding watermarks, logos, or special effects to a batch of images.
  • Consider the order of images in the batch; the node processes images in pairs, so ensure that each pair of bottom and top images corresponds correctly.

Batch Alpha Composite Common Errors and Solutions:

ValueError: Bottom layer must be in BHWC format with 3 channels

  • Explanation: This error occurs when the bottom_images input does not have the expected shape or number of channels.
  • Solution: Verify that the bottom_images tensor is in the correct format, with a shape of (B, H, W, 3), and that the values are normalized to the range [0, 1].

ValueError: Top layer must be in BHWC format with 4 channels

  • Explanation: This error is raised when the top_images input does not have the expected shape or number of channels.
  • Solution: Ensure that the top_images tensor is in the correct format, with a shape of (B, H, W, 4), and that the values are normalized to the range [0, 1].

Batch Alpha Composite Related Nodes

Go back to the extension to check out more related nodes.
DJZ-Nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.