Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > Rebalance-Pack > Mask Aspect Ratio BBox

ComfyUI Node: Mask Aspect Ratio BBox

Class Name

MaskAspectRatioBBox

Category
Rebalance-Pack/mask
Author
nova452 (Account age: 1390days)
Extension
Rebalance-Pack
Latest Updated
2026-07-30
Github Stars
0.47K

How to Install Rebalance-Pack

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

Mask Aspect Ratio BBox Description

Adjust mask aspect ratio to match specified dimensions within a bounding box for visual harmony in AI-generated artworks.

Mask Aspect Ratio BBox:

The MaskAspectRatioBBox node is designed to adjust the aspect ratio of a given mask to match specified dimensions, ensuring that the mask fits within a bounding box of the desired aspect ratio. This node is particularly useful for AI artists who need to maintain consistent aspect ratios across different masks, which is essential for tasks such as image composition and alignment. By manipulating the bounding box of the mask, this node helps in achieving a uniform look and feel across various elements in a project. The primary goal of this node is to provide a seamless way to enforce aspect ratios, which can be crucial for maintaining visual harmony in AI-generated artworks.

Mask Aspect Ratio BBox Input Parameters:

mask

The mask parameter represents the input mask that you want to adjust. It is a tensor that defines the area of interest within an image. The mask is typically a binary or grayscale image where the non-zero values indicate the region of interest. This parameter is crucial as it serves as the base for the aspect ratio adjustment process.

aspect_ratios

The aspect_ratios parameter is a string that specifies the desired aspect ratios for the bounding box. This parameter dictates how the mask will be resized or cropped to fit within the specified aspect ratio. It is important to provide valid aspect ratios to ensure the mask is adjusted correctly.

crop_position

The crop_position parameter determines the position from which the mask will be cropped to fit the desired aspect ratio. This parameter allows you to control the alignment of the mask within the bounding box, which can affect the composition of the final image.

enforce_min_pixels

The enforce_min_pixels parameter is a boolean that, when set to true, ensures that the mask maintains a minimum number of pixels after the aspect ratio adjustment. This is useful for preserving the integrity of the mask, especially when working with small or detailed regions.

Mask Aspect Ratio BBox Output Parameters:

out_mask

The out_mask is the adjusted mask that fits within the specified aspect ratio. It is a tensor that represents the modified area of interest, ensuring that the mask conforms to the desired dimensions. This output is essential for further processing or integration into larger compositions.

chosen

The chosen output is a string that indicates the aspect ratio that was applied to the mask. This provides feedback on the adjustment process, allowing you to verify that the correct aspect ratio was used.

Mask Aspect Ratio BBox Usage Tips:

  • Ensure that the aspect_ratios parameter is correctly formatted to avoid unexpected results in the mask adjustment process.
  • Use the crop_position parameter to control the alignment of the mask, which can be particularly useful for maintaining the focus on specific areas of interest.
  • Consider enabling enforce_min_pixels when working with small masks to prevent loss of detail during the aspect ratio adjustment.

Mask Aspect Ratio BBox Common Errors and Solutions:

"Invalid aspect ratio format"

  • Explanation: This error occurs when the aspect_ratios parameter is not formatted correctly.
  • Solution: Ensure that the aspect ratios are provided as a valid string format, such as "16:9" or "4:3".

"Mask is None"

  • Explanation: This error indicates that the input mask is not provided or is null.
  • Solution: Verify that a valid mask is passed to the node before execution.

"No non-zero values in mask"

  • Explanation: This error happens when the input mask does not contain any non-zero values, meaning there is no area of interest defined.
  • Solution: Check the input mask to ensure it correctly represents the area of interest with non-zero values.

Mask Aspect Ratio BBox Related Nodes

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

Mask Aspect Ratio BBox