ComfyUI > Nodes > kaytool > 𝙆 Preview Mask

ComfyUI Node: 𝙆 Preview Mask

Class Name

Preview_Mask

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

The `PreviewMask` node visualizes mask data in ComfyUI by converting it into a previewable image.

𝙆 Preview Mask:

The PreviewMask node is designed to facilitate the visualization of mask data within the ComfyUI environment. Its primary function is to convert mask data, which is typically used in image processing and computer vision tasks, into a format that can be easily previewed and saved as an image. This node is particularly useful for AI artists and developers who need to inspect and debug mask data during the development of AI models or image processing pipelines. By transforming the mask into a three-channel image, the PreviewMask node allows users to visually assess the mask's structure and coverage, ensuring that it aligns with their expectations and requirements. This capability is essential for tasks such as segmentation, where the accuracy and precision of the mask can significantly impact the final output. The node leverages PyTorch tensors for efficient computation and supports masks with two or three dimensions, automatically adjusting the data to ensure compatibility with image formats.

𝙆 Preview Mask Input Parameters:

mask

The mask parameter is a required input that represents the mask data to be visualized. It must be provided as a PyTorch tensor, which is a data structure commonly used in machine learning for efficient computation. The mask can have either two or three dimensions, corresponding to grayscale or multi-channel data, respectively. If the mask is in an 8-bit unsigned integer format, it will be converted to a floating-point format by dividing by 255.0 to normalize the values between 0 and 1. If the mask's maximum value exceeds 1.0, it will be scaled down accordingly. This parameter is crucial as it determines the content of the preview image, allowing users to inspect the mask's structure and ensure it meets their requirements.

𝙆 Preview Mask Output Parameters:

The PreviewMask node does not explicitly define output parameters in the context provided. However, its primary function is to save the visualized mask as an image file in the specified output directory. This image serves as the output, allowing users to view and analyze the mask data in a more accessible format.

𝙆 Preview Mask Usage Tips:

  • Ensure that the input mask is a PyTorch tensor with the correct dimensions (2 or 3) to avoid errors during execution.
  • Use the node to visually inspect masks during the development of image processing pipelines to ensure they align with your expectations.

𝙆 Preview Mask Common Errors and Solutions:

Input mask must be a PyTorch tensor.

  • Explanation: This error occurs when the input mask is not provided as a PyTorch tensor, which is the expected data type for this node.
  • Solution: Convert your mask data to a PyTorch tensor before passing it to the node.

Input mask must have 2 or 3 dimensions.

  • Explanation: The node expects the mask to have either two or three dimensions, corresponding to grayscale or multi-channel data.
  • Solution: Ensure that your mask data is reshaped or adjusted to meet the dimensionality requirements before inputting it into the node.

𝙆 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.