ComfyUI > Nodes > ComfyUI_XISER_Nodes > Mask Composite Operation

ComfyUI Node: Mask Composite Operation

Class Name

XIS_MaskCompositeOperation

Category
XISER_Nodes/Image_And_Mask
Author
grinlau18 (Account age: 944days)
Extension
ComfyUI_XISER_Nodes
Latest Updated
2026-03-20
Github Stars
0.03K

How to Install ComfyUI_XISER_Nodes

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

Mask Composite Operation Description

Performs composite operations on masks, enabling flexible blending and modification for AI artists.

Mask Composite Operation:

The XIS_MaskCompositeOperation node is designed to perform composite operations on input masks, offering a variety of operation types to manipulate and combine masks effectively. This node is particularly useful for AI artists who need to blend or modify mask layers in their creative workflows. By providing options such as addition, subtraction, intersection, and difference, the node allows for flexible and precise control over mask compositions. This capability is essential for tasks that require nuanced mask adjustments, such as image editing, compositing, and digital painting. The node's ability to handle multiple operations makes it a versatile tool in any digital artist's toolkit, enabling the creation of complex mask effects with ease.

Mask Composite Operation Input Parameters:

mask1

This parameter represents the primary mask input for the operation. It serves as the base mask upon which the composite operation will be applied. The mask should be provided as a tensor, and it is crucial for defining the initial state of the mask composition process.

operation

The operation parameter determines the type of composite operation to be performed on the masks. It offers options such as "add", "subtract", "intersect", and "difference", with "add" being the default. Each option specifies a different method of combining the masks, affecting the final output. For example, "add" will combine the masks by summing their values, while "subtract" will remove the values of the second mask from the first.

blur_radius

This parameter controls the blur radius applied to the mask, allowing for smooth transitions and softer edges. It accepts a float value ranging from 0.0 to 100.0, with a default of 0.0. Adjusting the blur radius can help in achieving more natural-looking mask blends by softening harsh edges.

expand_shrink

The expand_shrink parameter allows for the expansion or contraction of the mask boundaries. It accepts a float value, with a range from -100.0 to positive values. Positive values will expand the mask, while negative values will shrink it. This parameter is useful for fine-tuning the size of the mask to better fit the desired area.

invert_mask

This boolean parameter determines whether the mask should be inverted before the operation is applied. When set to true, the mask values are flipped, which can be useful for reversing the mask's effect or for specific compositional needs.

overlay_color

The overlay_color parameter specifies the color used for overlaying the mask on the reference image. This is particularly useful for visualizing the mask's effect on the image. The color should be provided as a string representing the desired color.

opacity

This parameter controls the opacity level of the overlay, allowing for adjustments in the transparency of the mask when applied to the reference image. It accepts a float value, with higher values resulting in a more opaque overlay.

mask2

An optional secondary mask input that can be used in conjunction with the primary mask for the composite operation. If provided, it should be a tensor of the same dimensions as mask1. This parameter is essential for operations that involve two masks, such as "subtract" or "intersect".

reference_image

An optional parameter that provides a reference image for the mask overlay. This image is used to visualize the effect of the mask operation, helping artists to see the impact of their adjustments in real-time.

Mask Composite Operation Output Parameters:

result_mask

The result_mask output is the final mask produced after the composite operation. It reflects the combined effect of the input masks and the selected operation, providing a new mask that can be used for further processing or as a final output in the artistic workflow.

overlay_image

The overlay_image output provides a visual representation of the mask applied to the reference image. This output is useful for artists to see how the mask affects the image, allowing for adjustments and refinements to achieve the desired visual effect.

Mask Composite Operation Usage Tips:

  • Experiment with different operation types to achieve unique mask effects, such as using "intersect" for precise mask overlaps or "difference" for highlighting differences between masks.
  • Utilize the blur_radius parameter to soften mask edges, which can help in creating more natural transitions between masked and unmasked areas.
  • Adjust the expand_shrink parameter to fine-tune the mask size, ensuring it fits the intended area perfectly without affecting surrounding regions.

Mask Composite Operation Common Errors and Solutions:

Empty mask batch received

  • Explanation: This error occurs when the input mask batch is empty, meaning no masks are provided for processing.
  • Solution: Ensure that the input masks are correctly loaded and passed to the node. Verify that the mask tensors are not empty and have the expected dimensions.

Mask dimension mismatch

  • Explanation: This error arises when the dimensions of mask1 and mask2 do not match, which is necessary for operations involving two masks.
  • Solution: Check that both masks have the same dimensions before performing operations. If necessary, resize mask2 to match the dimensions of mask1 using appropriate image processing techniques.

Mask Composite Operation Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_XISER_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 Models, enabling artists to harness the latest AI tools to create incredible art.

Mask Composite Operation