ComfyUI  >  Nodes  >  ComfyUI >  GrowMask

ComfyUI Node: GrowMask

Class Name

GrowMask

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

GrowMask Description

Modify mask size by expanding/contracting, precise control, tapered corners for smoother transitions, manage coverage area effectively.

GrowMask:

The GrowMask node is designed to modify the size of a given mask by either expanding or contracting it. This is particularly useful in image processing tasks where you need to adjust the boundaries of a mask to include or exclude more areas. The node allows for precise control over the expansion or contraction process, and it can also handle tapered corners to create smoother transitions. By using this node, you can effectively manage the mask's coverage area, which is essential for tasks like inpainting, segmentation, and other image manipulation operations.

GrowMask Input Parameters:

mask

The mask parameter is the input mask that you want to modify. This mask is typically a binary or grayscale image where the areas of interest are marked. The node will process this mask to either expand or contract its boundaries based on the other parameters.

expand

The expand parameter determines the number of pixels by which the mask should be expanded or contracted. It accepts integer values, with a default of 0. Positive values will expand the mask, while negative values will contract it. The range for this parameter is from -MAX_RESOLUTION to MAX_RESOLUTION, allowing for significant flexibility in mask adjustment.

tapered_corners

The tapered_corners parameter is a boolean that specifies whether the corners of the mask should be tapered during the expansion or contraction process. When set to True (the default value), the corners will be smoothed out, creating a more natural transition. If set to False, the corners will remain sharp.

GrowMask Output Parameters:

MASK

The output parameter MASK is the modified mask after the expansion or contraction process. This mask will have its boundaries adjusted according to the expand and tapered_corners parameters, making it ready for further image processing tasks.

GrowMask Usage Tips:

  • To create a smoother transition at the edges of your mask, enable the tapered_corners parameter.
  • Use negative values for the expand parameter to contract the mask, which can be useful for refining the area of interest.
  • Experiment with different expand values to achieve the desired mask size, especially when preparing masks for inpainting or segmentation tasks.

GrowMask Common Errors and Solutions:

"ValueError: Invalid mask shape"

  • Explanation: This error occurs when the input mask does not have the expected shape or dimensions.
  • Solution: Ensure that the input mask is a properly formatted binary or grayscale image with the correct dimensions.

"TypeError: Unsupported input type for mask"

  • Explanation: This error happens when the input mask is not of the expected type, such as a non-numeric array.
  • Solution: Verify that the input mask is a numeric array, typically a tensor or numpy array, and that it contains valid pixel values.

"RuntimeError: Expansion value out of range"

  • Explanation: This error is triggered when the expand parameter is set to a value outside the allowed range.
  • Solution: Adjust the expand parameter to be within the range of -MAX_RESOLUTION to MAX_RESOLUTION.

GrowMask 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.