ComfyUI > Nodes > comfyui-tensorop > MaskImage

ComfyUI Node: MaskImage

Class Name

MaskImage

Category
tensorops
Author
un-seen (Account age: 1647days)
Extension
comfyui-tensorop
Latest Updated
2024-10-26
Github Stars
0.03K

How to Install comfyui-tensorop

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

MaskImage Description

Apply masks to images for selective visibility control, essential for compositing and image processing tasks.

MaskImage:

The MaskImage node is designed to apply a mask to an image, effectively allowing you to selectively reveal or conceal parts of the image based on the mask's values. This node is particularly useful in image processing tasks where you need to focus on specific areas of an image while ignoring others. By multiplying the image with the mask, the node ensures that only the areas corresponding to the mask's active regions are visible in the output. This operation is essential for tasks such as compositing, where precise control over image visibility is required. The MaskImage node leverages the power of tensor operations to efficiently handle image and mask data, making it a valuable tool for AI artists looking to manipulate images with precision.

MaskImage Input Parameters:

image

The image parameter expects an input of type IMAGE, which is the main image you want to process. This parameter is crucial as it provides the base content that will be affected by the mask. The image should be in a format compatible with tensor operations, typically a multi-dimensional array representing pixel values. The quality and resolution of the image can impact the final output, so it's important to use an image that meets your project's requirements.

mask

The mask parameter requires an input of type MASK, which is used to determine which parts of the image will be visible in the output. The mask is a tensor that should have the same spatial dimensions as the image, ensuring that each pixel in the mask corresponds to a pixel in the image. The mask values typically range from 0 to 1, where 0 represents fully transparent (concealed) areas and 1 represents fully opaque (visible) areas. This parameter is essential for controlling the visibility of different parts of the image.

MaskImage Output Parameters:

IMAGE

The output of the MaskImage node is an IMAGE, which is the result of applying the mask to the input image. This output image retains the original dimensions of the input image but only displays the areas specified by the mask. The masked image is useful for further processing or as a final output in image compositing tasks. The output image's quality and appearance depend on the input image and mask, so careful selection of these inputs is important for achieving the desired result.

MaskImage Usage Tips:

  • Ensure that the mask and image have matching dimensions to avoid errors and ensure accurate masking.
  • Use masks with clear and distinct values (0 or 1) for precise control over which parts of the image are visible.
  • Experiment with different mask patterns to achieve creative effects, such as highlighting specific areas or creating complex compositions.

MaskImage Common Errors and Solutions:

Cannot use a mask without an input image

  • Explanation: This error occurs when a mask is provided without an accompanying image.
  • Solution: Ensure that both an image and a mask are provided as inputs to the node.

Cannot use a mask with multiple image

  • Explanation: This error indicates that the input image has multiple channels or dimensions that are not compatible with the mask.
  • Solution: Use a single-channel image that matches the dimensions of the mask.

Mask and Image must be the same size

  • Explanation: This error arises when the dimensions of the mask do not match those of the image.
  • Solution: Adjust the mask or image dimensions so that they are identical, ensuring proper alignment for the masking operation.

MaskImage Related Nodes

Go back to the extension to check out more related nodes.
comfyui-tensorop
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 Playground, enabling artists to harness the latest AI tools to create incredible art.