ComfyUI-KJNodes
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
ImageAndMaskPreview
ImageAndMaskPreview Node Documentation
Overview
The ImageAndMaskPreview node is a utility in the ComfyUI-KJNodes collection that allows users to preview images, masks, or a composite of both with customizable overlay options. This node is particularly useful for visualizing how masks will interact with images, offering an overlay feature to blend masks onto images for a more integrated viewing experience. Additionally, this node can bypass the preview functionality if needed, returning the composite result directly for further processing.
Inputs
The node accepts the following inputs:
-
Mask Opacity: A float value determining the transparency level of the mask when composited onto the image. The value can range from 0.0 (completely transparent) to 1.0 (completely opaque).
-
Mask Color: A string defining the color of the mask overlay. This can be an RGB string (e.g., "255, 255, 255" for white) or a hexadecimal color code (e.g., "#FFFFFF").
-
Pass Through: A boolean value that determines whether to disable the preview and pass the composite image directly to the output. If set to
True, the preview is bypassed. -
Image (Optional): An image input that serves as the base for overlaying the mask. If only the image is provided, it's returned unchanged.
-
Mask (Optional): A mask input that can be overlaid on the provided image. If only the mask is provided, it is displayed as a standalone image.
Outputs
- Composite: This is the resultant image after processing, which can be either an unchanged image, a standalone mask, or a composite of both, depending on the provided inputs and settings.
Usage in ComfyUI Workflows
The ImageAndMaskPreview node is versatile and can be utilized in a variety of ComfyUI workflows:
-
Previewing Masks: When developing or adjusting masks, users can use this node to visualize how a mask would appear with various opacity and color settings, ensuring it aligns with their desired outcomes before further processing.
-
Creating Overlays: Users can overlay masks onto images directly within the UI for quick checks on how visual elements combine. This is especially useful for tasks involving image segmentation or modification.
-
Intermediate Processing: By leveraging the pass-through feature, this node can act as an intermediary step in pipelines where preview is unnecessary, and composited images are required for subsequent operations.
-
Visual Testing: Given its capability to color masks and adjust opacity, it aids in visual testing and debugging of UI elements where understanding mask effects over base images is crucial.
Special Features and Considerations
-
Color and Opacity Customization: Users can effectively test different mask overlay appearances without modifying the original asset files, making iterative design changes more efficient.
-
Flexible Input Handling: The node can function with either image or mask alone or with both simultaneously, providing outputs suited to their combination, thus making it adaptable to a broad range of scenarios.
-
Pass-Through Capability: The ability to bypass the preview and use this node strictly for compositing is a highly beneficial feature for workflow optimization, particularly in automated or batch processing tasks.
By incorporating the ImageAndMaskPreview node into your ComfyUI pipeline, you gain enhanced control over visualizing and integrating mask elements within your projects, streamlining both creative and technical workflows.