ComfyUI Node: Composite

Class Name

Composite

Category
background-edit
Author
yondonfu (Account age: 4198days)
Extension
ComfyUI-Background-Edit
Latest Updated
2024-12-31
Github Stars
0.02K

How to Install ComfyUI-Background-Edit

Install this extension via the ComfyUI Manager by searching for ComfyUI-Background-Edit
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Background-Edit 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

Composite Description

Efficiently blend foreground and background images with masks for advanced image editing and layer integration using PyTorch tensors.

Composite:

The Composite node is designed to seamlessly blend foreground and background images using a specified mask, allowing for sophisticated image editing and manipulation. This node is particularly useful for tasks that require the integration of different image layers, such as creating composite images or applying effects selectively. By leveraging the power of PyTorch tensors, the Composite node efficiently processes images on either CPU or GPU, depending on the selected mode, ensuring optimal performance. The primary goal of this node is to provide a flexible and efficient way to combine images, making it an essential tool for AI artists looking to enhance their creative workflows.

Composite Input Parameters:

foregrounds

The foregrounds parameter represents the image or images that you want to overlay onto the background. This input is crucial as it defines the visual content that will be placed over the background image. The parameter accepts images in the form of PyTorch tensors, allowing for high-performance processing. The number of foreground images must match the number of background images and masks to ensure proper compositing.

backgrounds

The backgrounds parameter is the image or images that serve as the base layer onto which the foregrounds will be composited. This parameter is essential as it provides the context or setting for the composite image. Like the foregrounds, the backgrounds are also provided as PyTorch tensors, and their count must match that of the foregrounds and masks.

foreground_masks

The foreground_masks parameter is a mask or set of masks that determine the transparency and blending of the foreground images with the background. This parameter is critical for defining which parts of the foreground are visible and how they blend with the background. The masks are provided as PyTorch tensors, and their dimensions must align with those of the foregrounds and backgrounds.

mode

The mode parameter specifies the processing device, either "cuda" for GPU or "cpu" for CPU. This parameter is important for optimizing the node's performance based on the available hardware. The default value is "cuda", which is recommended for faster processing if a compatible GPU is available. If not, the "cpu" mode can be used as an alternative.

Composite Output Parameters:

IMAGE

The output of the Composite node is an IMAGE, which is the result of blending the foregrounds and backgrounds according to the specified masks. This output is a PyTorch tensor that represents the final composited image, ready for further processing or display. The output image retains the dimensions and characteristics of the input images, providing a seamless integration of the foreground and background elements.

Composite Usage Tips:

  • Ensure that the number of foregrounds, backgrounds, and masks are equal to avoid mismatches and errors during processing.
  • Utilize the "cuda" mode for faster processing if you have a compatible GPU, as it significantly speeds up the compositing process.
  • Experiment with different masks to achieve various blending effects and enhance the visual appeal of your composite images.

Composite Common Errors and Solutions:

mismatch number of backgrounds, foregrounds and foreground masks

  • Explanation: This error occurs when the number of foregrounds, backgrounds, and masks do not match, leading to an inability to properly composite the images.
  • Solution: Ensure that the number of images in each input parameter is the same. Double-check your inputs to confirm that they align correctly.

invalid mode

  • Explanation: This error is raised when an unsupported mode is specified for processing, such as a typo or an unrecognized value.
  • Solution: Verify that the mode parameter is set to either "cuda" or "cpu". Correct any typos or unsupported values to resolve the issue.

Composite Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Background-Edit
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.