ComfyUI > Nodes > ComfyUI 1hewNodes > Image Mask Crop

ComfyUI Node: Image Mask Crop

Class Name

1hew_ImageMaskCrop

Category
1hewNodes/image/crop
Author
1hew (Account age: 1113days)
Extension
ComfyUI 1hewNodes
Latest Updated
2026-04-17
Github Stars
0.03K

How to Install ComfyUI 1hewNodes

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

Image Mask Crop Description

Facilitates precise image cropping using masks to isolate specific areas for processing.

Image Mask Crop:

The 1hew_ImageMaskCrop node is designed to facilitate the precise cropping of images using a mask to define the area of interest. This node is particularly useful for AI artists who need to isolate specific parts of an image for further processing or analysis. By leveraging a mask, the node can determine the bounding box of the area to be cropped, ensuring that only the desired portion of the image is retained. This functionality is essential for tasks that require focused attention on particular image regions, such as object detection or segmentation. The node automatically adjusts the mask to fit the image dimensions if necessary, ensuring seamless integration into your workflow. Its ability to handle different image and mask sizes makes it a versatile tool for various image processing tasks.

Image Mask Crop Input Parameters:

mask

The mask parameter is a crucial input that defines the area of the image to be cropped. It is typically a binary image where the region of interest is marked. The mask guides the node in determining the bounding box for cropping. The effectiveness of the cropping process heavily relies on the accuracy and precision of this mask. There are no specific minimum or maximum values, but the mask should match the dimensions of the image for optimal results.

output_alpha

The output_alpha parameter determines whether the output image should include an alpha channel, which represents transparency. This is particularly useful when you want to retain transparency information in the cropped image, allowing for seamless overlay on other images or backgrounds. The default value is typically set to False, meaning no alpha channel is included unless specified otherwise.

output_crop

The output_crop parameter specifies whether the node should output the cropped image directly. When set to True, the node will return the cropped portion of the image as defined by the mask. This is useful when you need to isolate and work with the cropped section independently. The default setting is usually False, meaning the full image with the mask applied is returned unless cropping is explicitly requested.

pad_crop

The pad_crop parameter allows you to add padding around the cropped area. This can be useful if you want to include some additional context around the cropped region. The padding is specified in pixels, and the node will adjust the bounding box accordingly. The default value is typically 0, meaning no padding is added unless specified.

Image Mask Crop Output Parameters:

img_t

The img_t output parameter represents the tensor of the cropped image. This tensor is the result of applying the mask to the original image, and it contains the pixel data of the cropped region. This output is essential for further processing or analysis, as it provides the isolated image section defined by the mask.

mk_t

The mk_t output parameter is the tensor representation of the mask applied to the image. This output is useful for understanding the area that was cropped and can be used for further processing or visualization. It provides a clear indication of the mask's effect on the image, allowing for easy verification of the cropping process.

Image Mask Crop Usage Tips:

  • Ensure that the mask accurately represents the area you wish to crop to achieve the best results. A precise mask will lead to a more accurate cropping process.
  • Consider using the output_alpha parameter if you need to retain transparency in the cropped image, especially when overlaying it on different backgrounds.

Image Mask Crop Common Errors and Solutions:

Mask and Image Size Mismatch

  • Explanation: This error occurs when the dimensions of the mask do not match the dimensions of the image, leading to incorrect cropping.
  • Solution: Ensure that the mask and image have the same dimensions before processing. You can resize the mask to match the image size if necessary.

Invalid Bounding Box

  • Explanation: This error arises when the bounding box calculated from the mask is invalid, possibly due to an incorrect or empty mask.
  • Solution: Verify that the mask correctly highlights the area of interest and is not empty. Adjust the mask to ensure it accurately defines the region to be cropped.

Image Mask Crop Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI 1hewNodes
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.

Image Mask Crop