ComfyUI  >  Nodes  >  WAS Node Suite >  Bounded Image Crop with Mask

ComfyUI Node: Bounded Image Crop with Mask

Class Name

Bounded Image Crop with Mask

Category
WAS Suite/Image/Bound
Author
WASasquatch (Account age: 4688 days)
Extension
WAS Node Suite
Latest Updated
8/25/2024
Github Stars
1.1K

How to Install WAS Node Suite

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

Bounded Image Crop with Mask Description

Node for precise image cropping based on masks, ideal for AI artists and image processing tasks.

Bounded Image Crop with Mask:

The Bounded Image Crop with Mask node is designed to crop images based on a provided mask, allowing for precise extraction of regions of interest within an image. This node is particularly useful for AI artists who need to isolate specific parts of an image for further processing or analysis. By using a mask to define the area to be cropped, this node ensures that only the relevant portions of the image are retained, while unwanted areas are discarded. Additionally, the node allows for customizable padding around the cropped region, providing flexibility in how much surrounding context is included. This functionality is essential for tasks such as object detection, segmentation, and image enhancement, where focusing on specific regions can significantly improve the quality and accuracy of the results.

Bounded Image Crop with Mask Input Parameters:

image

The image parameter represents the input image that you want to crop. This image should be in a tensor format, and it can be either a single image or a batch of images. The node will process each image individually based on the provided mask.

mask

The mask parameter is a binary mask that defines the region of interest within the image. The mask should have the same spatial dimensions as the input image, with non-zero values indicating the area to be retained. If the number of masks does not match the number of images, the first mask will be used for all images.

padding_left

The padding_left parameter specifies the amount of padding to be added to the left side of the cropped region. This value is an integer and can be adjusted to include more or less of the surrounding context. The default value is 0, and it can be increased as needed.

padding_right

The padding_right parameter specifies the amount of padding to be added to the right side of the cropped region. Similar to padding_left, this value is an integer and can be adjusted to control the amount of surrounding context included. The default value is 0.

padding_top

The padding_top parameter specifies the amount of padding to be added to the top of the cropped region. This value is an integer and can be adjusted to include more or less of the surrounding context. The default value is 0.

padding_bottom

The padding_bottom parameter specifies the amount of padding to be added to the bottom of the cropped region. Similar to padding_top, this value is an integer and can be adjusted to control the amount of surrounding context included. The default value is 0.

Bounded Image Crop with Mask Output Parameters:

cropped_images

The cropped_images parameter is the output tensor containing the cropped regions of the input images. Each cropped image corresponds to the region defined by the mask and includes any specified padding. This output is useful for further processing or analysis of the isolated regions.

all_bounds

The all_bounds parameter is a list of bounding boxes for each cropped region. Each bounding box is represented as a list of four integers: [rmin, rmax, cmin, cmax], indicating the row and column indices of the cropped region. This information is valuable for understanding the spatial location of the cropped regions within the original images.

Bounded Image Crop with Mask Usage Tips:

  • Ensure that the mask accurately defines the region of interest within the image to achieve precise cropping results.
  • Adjust the padding parameters to include additional context around the cropped region, which can be useful for tasks that require some surrounding information.
  • Use this node in conjunction with other image processing nodes to enhance the quality and accuracy of your AI models.

Bounded Image Crop with Mask Common Errors and Solutions:

Mismatched image and mask dimensions

  • Explanation: The dimensions of the input image and mask do not match, causing an error during processing.
  • Solution: Ensure that the mask has the same spatial dimensions as the input image before passing them to the node.

Insufficient padding values

  • Explanation: Padding values are set too high, causing the cropped region to exceed the image boundaries.
  • Solution: Adjust the padding values to ensure they do not exceed the dimensions of the input image.

Single mask for multiple images

  • Explanation: Only one mask is provided for a batch of images, leading to the same mask being applied to all images.
  • Solution: Provide a separate mask for each image in the batch to achieve accurate cropping for each individual image.

Bounded Image Crop with Mask Related Nodes

Go back to the extension to check out more related nodes.
WAS Node Suite
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.