ImageAndMaskPreview
This node inherits from the SaveImage class, but its primary purpose is to generate temporary preview images rather than permanently saving them.
Image And Mask Preview
The ImageAndMaskPreview node, which inherits from the SaveImage class, is primarily designed to generate temporary preview images rather than for permanent saving.
The ImageAndMaskPreview node is a utility tool for previewing images and masks. Its core functionality is to allow users to view the image or mask individually, or to overlay the mask onto the image with a specified color and transparency, enabling intuitive inspection of the masked areas.
Node Functionality
This node inherits from the SaveImage class but is primarily intended for generating temporary previews rather than permanent saves. It supports multiple color formats for defining the mask color, including RGB tuples, RGBA tuples, and hexadecimal codes. When both an image and a mask are provided, the node composites the mask onto the image with the set opacity and color; if only one is provided, it directly outputs a preview of that element.
Node Parameter Description - ImageAndMaskPreview
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
image | IMAGE | No | - | - | Optional input image to preview or to composite the mask onto. |
mask | MASK | No | - | - | Optional input mask to preview or to composite over the image. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
mask_opacity | FLOAT | Yes | 1.0 | 0.0 - 1.0 (step: 0.01) | mask_opacity (input parameter): Controls the overall opacity of the mask overlaid on the image. Value range is 0.0 (fully transparent) to 1.0 (fully opaque), with an adjustment step of 0.01. |
mask_color | STRING | Yes | 255, 255, 255 | - | RGBA (e.g., "255,255,255,128") or hexadecimal (e.g., "#FF0000") format. |
pass_through | BOOLEAN | Yes | False | - | pass_through (input parameter): When enabled, the node disables the UI preview and directly passes the composited image data from the output port. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| composite | IMAGE | - |
Usage Scenarios
This node is highly useful in image processing workflows. For example, after generating a mask, you can connect it to this node and set the mask_color to a noticeable red to quickly verify if the mask accurately covers the target area. Alternatively, before a video compositing pipeline, you can use its pass_through functionality to directly pass the composited result to subsequent animation combination nodes without interrupting the flow to view a preview.
Notes
It is important to note that when the pass_through mode is enabled, the node will not display a preview image in the interface but will directly pass the composited result from the output port. Additionally, the mask color supports RGBA format, meaning you can specify an independent transparency for the color itself, which works in conjunction with the overall mask_opacity parameter.
ImageAndMaskPreview Node Source Code Link
The ImageAndMaskPreview node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.