ComfyUI  >  Nodes  >  KJNodes for ComfyUI >  Resize Mask

ComfyUI Node: Resize Mask

Class Name

ResizeMask

Category
KJNodes/masking
Author
kijai (Account age: 2192 days)
Extension
KJNodes for ComfyUI
Latest Updated
6/25/2024
Github Stars
0.3K

How to Install KJNodes for ComfyUI

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

Resize Mask Description

ResizeMask node standardizes mask dimensions, maintains aspect ratio for uniform sizing in processing tasks.

Resize Mask:

The ResizeMask node is designed to adjust the dimensions of a given mask or a batch of masks to a specified width and height. This node is particularly useful when you need to standardize the size of masks for further processing or analysis. One of the key features of this node is its ability to maintain the aspect ratio of the original mask if desired, ensuring that the resized mask does not become distorted. By leveraging this node, you can ensure that your masks are consistently sized, which is crucial for tasks that require uniform input dimensions.

Resize Mask Input Parameters:

mask

The mask parameter represents the input mask or a batch of masks that you want to resize. This is the primary input on which the resizing operation will be performed.

width

The width parameter specifies the desired width of the resized mask. It accepts integer values with a default of 512, a minimum of 0, and a maximum defined by MAX_RESOLUTION. The step size for this parameter is 8. If the keep_proportions parameter is set to True, this value will be adjusted to maintain the aspect ratio of the original mask.

height

The height parameter specifies the desired height of the resized mask. Similar to the width parameter, it accepts integer values with a default of 512, a minimum of 0, and a maximum defined by MAX_RESOLUTION. The step size for this parameter is 8. If the keep_proportions parameter is set to True, this value will be adjusted to maintain the aspect ratio of the original mask.

keep_proportions

The keep_proportions parameter is a boolean that determines whether the aspect ratio of the original mask should be preserved during resizing. The default value is False. When set to True, the node will adjust the width and height to ensure that the resized mask maintains the same proportions as the original.

Resize Mask Output Parameters:

mask

The mask output is the resized version of the input mask. This output will have the dimensions specified by the width and height parameters, or adjusted dimensions if keep_proportions is set to True.

width

The width output represents the actual width of the resized mask. This value may differ from the input width if keep_proportions is set to True.

height

The height output represents the actual height of the resized mask. This value may differ from the input height if keep_proportions is set to True.

Resize Mask Usage Tips:

  • To maintain the aspect ratio of your original mask, set the keep_proportions parameter to True. This is particularly useful when resizing masks for visual consistency.
  • Use the default width and height values (512) for standard resizing tasks, but adjust these values based on the specific requirements of your project.
  • Ensure that the input mask is correctly formatted and has the expected dimensions before applying the ResizeMask node to avoid unexpected results.

Resize Mask Common Errors and Solutions:

"Invalid mask input"

  • Explanation: The input provided for the mask parameter is not in the expected format or is corrupted.
  • Solution: Verify that the input mask is correctly formatted and not corrupted. Ensure that it matches the expected dimensions and data type.

"Width or height out of range"

  • Explanation: The specified width or height is outside the allowable range defined by MAX_RESOLUTION.
  • Solution: Adjust the width and height parameters to be within the allowable range. Ensure that the values are between 0 and MAX_RESOLUTION.

"Resizing failed due to aspect ratio constraints"

  • Explanation: The resizing operation failed because the keep_proportions parameter is set to True, and the specified width and height cannot maintain the aspect ratio.
  • Solution: Re-evaluate the specified width and height values. Ensure that they are compatible with the aspect ratio of the original mask when keep_proportions is set to True.

Resize Mask Related Nodes

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