ComfyUI  >  Nodes  >  ComfyUI >  CropMask

ComfyUI Node: CropMask

Class Name

CropMask

Category
mask
Author
ComfyAnonymous (Account age: 598 days)
Extension
ComfyUI
Latest Updated
8/12/2024
Github Stars
45.9K

How to Install ComfyUI

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

CropMask Description

Extract specific rectangular region from mask for focused processing, enabling precise isolation and detailed attention in image tasks.

CropMask:

The CropMask node is designed to allow you to extract a specific rectangular region from a given mask. This can be particularly useful when you need to focus on a particular area of an image or mask for further processing or analysis. By specifying the coordinates and dimensions of the desired region, the CropMask node enables precise control over the portion of the mask you want to isolate. This functionality is essential for tasks that require detailed attention to specific areas, such as image editing, object detection, or any scenario where you need to work with a subset of the original mask.

CropMask Input Parameters:

mask

The mask parameter represents the input mask from which you want to crop a specific region. This is the primary data that the node will process to extract the desired area.

x

The x parameter specifies the horizontal coordinate of the top-left corner of the cropping rectangle. It determines where the cropping will start along the x-axis. The value must be an integer, with a default of 0, a minimum of 0, and a maximum defined by MAX_RESOLUTION.

y

The y parameter specifies the vertical coordinate of the top-left corner of the cropping rectangle. It determines where the cropping will start along the y-axis. The value must be an integer, with a default of 0, a minimum of 0, and a maximum defined by MAX_RESOLUTION.

width

The width parameter defines the width of the cropping rectangle. It determines how wide the cropped region will be. The value must be an integer, with a default of 512, a minimum of 1, and a maximum defined by MAX_RESOLUTION.

height

The height parameter defines the height of the cropping rectangle. It determines how tall the cropped region will be. The value must be an integer, with a default of 512, a minimum of 1, and a maximum defined by MAX_RESOLUTION.

CropMask Output Parameters:

MASK

The output parameter MASK represents the cropped region of the input mask. This is the extracted portion of the mask based on the specified coordinates and dimensions, and it can be used for further processing or analysis.

CropMask Usage Tips:

  • To focus on a specific area of your mask, carefully set the x and y parameters to the top-left corner of the region you want to crop.
  • Adjust the width and height parameters to match the size of the area you need. Ensure that the dimensions do not exceed the boundaries of the original mask to avoid errors.

CropMask Common Errors and Solutions:

"IndexError: index out of bounds"

  • Explanation: This error occurs when the specified x, y, width, or height parameters exceed the dimensions of the input mask.
  • Solution: Ensure that the x and y coordinates, along with the width and height, are within the bounds of the input mask's dimensions. Adjust the parameters accordingly to fit within the mask's size.

"ValueError: invalid dimensions"

  • Explanation: This error occurs when the width or height parameters are set to values less than 1.
  • Solution: Ensure that the width and height parameters are set to at least 1. Adjust the values to meet the minimum requirement.

CropMask Related Nodes

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