ComfyUI > Nodes > kaytool > 𝙆 Preview Mask +

ComfyUI Node: 𝙆 Preview Mask +

Class Name

Preview_Mask_Plus

Category
KayTool/Mask
Author
kk8bit (Account age: 1010days)
Extension
kaytool
Latest Updated
2026-04-06
Github Stars
0.34K

How to Install kaytool

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

𝙆 Preview Mask + Description

Enhances mask visualization with overlay options, multiple modes, and customizable backgrounds.

𝙆 Preview Mask +:

The Preview_Mask_Plus node is designed to enhance the visualization of image masks by providing a variety of preview options. This node allows you to overlay masks on images or display them independently, offering flexibility in how you inspect and utilize mask data. It supports multiple preview modes, including displaying the original image, the mask itself, or a combination of both with customizable background colors. This functionality is particularly beneficial for AI artists who need to visualize and debug mask applications in their creative workflows. By offering options to invert masks and choose different background colors, Preview_Mask_Plus provides a comprehensive tool for mask visualization, ensuring that you can tailor the preview to suit your specific needs and preferences.

𝙆 Preview Mask + Input Parameters:

invert_mask

This parameter is a boolean option that allows you to invert the mask values. When set to True, the mask values are inverted, meaning areas that were previously masked (value 1) become unmasked (value 0), and vice versa. This can be useful when you need to reverse the mask's effect without altering the original mask data. The default value is False.

Preview

The Preview parameter determines how the mask and image are displayed. It offers several options: none, image, mask, Black, White, Gray, Red, Green, and Blue. Choosing image displays the original image, mask shows the mask in grayscale, and none overlays the mask on the image with transparency. The color options allow you to set a solid background color behind the mask, which can help in visualizing the mask's effect against different backgrounds. This flexibility aids in better understanding and debugging of mask applications.

image

This parameter accepts the input image on which the mask will be applied or previewed. The image should be in a format compatible with PyTorch tensors, typically with dimensions representing batch size, height, width, and color channels. The image serves as the foreground in the preview process, and its interaction with the mask is determined by the Preview setting.

mask

The mask parameter is the core input that defines the areas of interest or exclusion on the image. It must be a PyTorch tensor with 2 or 3 dimensions, representing the mask's spatial dimensions and optionally a batch dimension. The mask values typically range from 0 to 1, where 0 indicates no masking and 1 indicates full masking. Properly configuring this parameter is crucial for accurate mask visualization.

𝙆 Preview Mask + Output Parameters:

None

The Preview_Mask_Plus node does not produce direct output parameters in the form of data returned to other nodes. Instead, its primary function is to generate and save visual previews of the mask and image combinations based on the specified input parameters. These previews are saved to a designated output directory, allowing you to inspect and utilize them as needed in your workflow.

𝙆 Preview Mask + Usage Tips:

  • Use the invert_mask option to quickly reverse the mask's effect without modifying the original mask data, which can be useful for testing different masking scenarios.
  • Experiment with different Preview settings to find the most informative visualization for your specific task, especially when debugging complex mask applications.
  • Ensure that the input mask is properly normalized and formatted as a PyTorch tensor to avoid errors and ensure accurate previews.

𝙆 Preview Mask + Common Errors and Solutions:

"Input mask must be a PyTorch tensor."

  • Explanation: This error occurs when the provided mask is not in the expected PyTorch tensor format.
  • Solution: Ensure that the mask is converted to a PyTorch tensor before passing it to the node.

"Input mask must have 2 or 3 dimensions."

  • Explanation: The mask provided does not have the correct number of dimensions, which should be either 2 or 3. - Solution: Check the dimensions of your mask and adjust it to have either 2 (height, width) or 3 (batch size, height, width) dimensions.

"Input mask must be a PyTorch tensor."

  • Explanation: This error indicates that the mask is not in the correct data type.
  • Solution: Convert the mask to a PyTorch tensor using torch.tensor() or ensure it is loaded as a tensor from the start.

"Mask values must be normalized between 0 and 1."

  • Explanation: The mask contains values outside the expected range of 0 to 1.
  • Solution: Normalize the mask values by dividing by the maximum value if necessary, ensuring all values fall within the 0 to 1 range.

𝙆 Preview Mask + Related Nodes

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