ComfyUI > Nodes > KJNodes for ComfyUI > ImageAndMaskPreview

ComfyUI Node: ImageAndMaskPreview

Class Name

ImageAndMaskPreview

Category
KJNodes
Author
kijai (Account age: 2192days)
Extension
KJNodes for ComfyUI
Latest Updated
2024-06-25
Github Stars
0.35K

How to Install KJNodes for ComfyUI

Install this extension via the ComfyUI Manager by searching for KJNodes for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter KJNodes for ComfyUI 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ImageAndMaskPreview Description

Visualize image and mask overlay with opacity/color adjustments, supports missing elements, and saves previews with custom filenames.

ImageAndMaskPreview:

The ImageAndMaskPreview node is designed to provide a visual preview of an image and its corresponding mask, allowing you to see how the mask overlays on the image. This node is particularly useful for AI artists who need to fine-tune their image processing workflows by visualizing the effects of masks on images. It supports various configurations such as adjusting the mask's opacity and color, and it can handle cases where either the image or the mask is missing. The node can also save the preview images with customizable filenames, making it easier to manage and organize your work.

ImageAndMaskPreview Input Parameters:

mask_opacity

This parameter controls the transparency level of the mask when it is overlaid on the image. A value of 0 means the mask is fully transparent, while a value of 1 means the mask is fully opaque. Adjusting this parameter helps in visualizing how the mask affects the underlying image. The default value is typically set to 1.

mask_color

This parameter specifies the color of the mask. It can be provided in either RGB format (e.g., "255,0,0" for red) or hexadecimal format (e.g., "#FF0000" for red). This allows you to customize the mask's appearance to better distinguish it from the image. The default color is usually set to a neutral color like white.

pass_through

A boolean parameter that determines whether the node should return the preview image directly or save it to a file. If set to True, the node will return the preview image; if set to False, it will save the image with a specified filename prefix. The default value is False.

filename_prefix

This parameter allows you to specify a prefix for the filenames of the saved preview images. This is useful for organizing and identifying your saved images. The default value is "ComfyUI".

image

This parameter accepts the input image that you want to preview with the mask. If no image is provided, the node will only process the mask.

mask

This parameter accepts the input mask that you want to overlay on the image. If no mask is provided, the node will only process the image.

prompt

This optional parameter allows you to add a text prompt that can be saved as metadata with the preview image. This is useful for keeping track of the context or settings used for generating the preview.

extra_pnginfo

This optional parameter allows you to add additional metadata to the saved PNG files. This can include any extra information you want to store with the image, such as settings or parameters used during processing.

ImageAndMaskPreview Output Parameters:

preview

The output of this node is the preview image, which shows the input image with the mask overlaid according to the specified parameters. This allows you to visually inspect how the mask interacts with the image, helping you make any necessary adjustments.

ImageAndMaskPreview Usage Tips:

  • Adjust the mask_opacity parameter to find the right balance between the visibility of the mask and the underlying image.
  • Use the mask_color parameter to set a color that contrasts well with your image, making it easier to see the mask.
  • Set pass_through to True if you want to quickly preview the image without saving it, which can speed up your workflow.
  • Use the filename_prefix to organize your saved images, especially when working on multiple projects or iterations.

ImageAndMaskPreview Common Errors and Solutions:

"Mask and image dimensions do not match"

  • Explanation: This error occurs when the dimensions of the mask and the image are not the same.
  • Solution: Ensure that the mask and image have the same width and height before passing them to the node.

"Invalid mask color format"

  • Explanation: This error occurs when the mask color is not provided in a valid RGB or hexadecimal format.
  • Solution: Check the mask_color parameter and ensure it is in the correct format, either "R,G,B" or "#RRGGBB".

"Image or mask not provided"

  • Explanation: This error occurs when neither an image nor a mask is provided to the node.
  • Solution: Ensure that at least one of the image or mask parameters is provided.

"Failed to save image"

  • Explanation: This error occurs when the node is unable to save the preview image to the specified location.
  • Solution: Check the file path and permissions to ensure the node can write to the specified directory.

ImageAndMaskPreview Related Nodes

Go back to the extension to check out more related nodes.
KJNodes for ComfyUI
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.