ComfyUI > Nodes > Bmad Nodes > AdjustRect

ComfyUI Node: AdjustRect

Class Name

AdjustRect

Category
Bmad
Author
bmad4ever (Account age: 3591days)
Extension
Bmad Nodes
Latest Updated
2024-08-02
Github Stars
0.05K

How to Install Bmad Nodes

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

AdjustRect Description

Modify rectangular regions within an image with precise control over dimensions, position, scaling, and centering for framing and composition.

AdjustRect:

The AdjustRect node is designed to modify rectangular regions within an image based on specified parameters. This node allows you to adjust the dimensions and position of a rectangle by scaling and centering it according to given factors. The primary goal of this node is to facilitate precise control over rectangular selections, which can be particularly useful in image processing tasks such as cropping, resizing, or focusing on specific areas of an image. By providing a flexible and intuitive way to manipulate rectangles, AdjustRect helps you achieve the desired framing and composition in your visual projects.

AdjustRect Input Parameters:

a

This parameter represents the first coordinate of the rectangle. It is used as part of the input to define the initial position and size of the rectangle.

b

This parameter represents the second coordinate of the rectangle. It works in conjunction with the other coordinates to define the initial rectangle.

c

This parameter represents the third coordinate of the rectangle. It is used to help define the initial dimensions and position of the rectangle.

d

This parameter represents the fourth coordinate of the rectangle. Along with the other coordinates, it defines the initial rectangle's boundaries.

xm

This parameter specifies the horizontal scaling factor. It determines how much the width of the rectangle should be adjusted. The value should be an even number to ensure proper scaling.

ym

This parameter specifies the vertical scaling factor. It determines how much the height of the rectangle should be adjusted. The value should be an even number to ensure proper scaling.

round_mode

This parameter defines the rounding mode to be used when calculating the new dimensions of the rectangle. It affects how the scaling factors are applied and rounded.

input_format

This parameter specifies the format of the input coordinates. It determines how the initial rectangle coordinates are interpreted and converted.

output_format

This parameter specifies the format of the output coordinates. It determines how the adjusted rectangle coordinates are formatted and returned.

AdjustRect Output Parameters:

x1

The first coordinate of the adjusted rectangle. It represents the new position after scaling and centering.

y1

The second coordinate of the adjusted rectangle. It represents the new position after scaling and centering.

x2

The third coordinate of the adjusted rectangle. It represents the new position after scaling and centering.

y2

The fourth coordinate of the adjusted rectangle. It represents the new position after scaling and centering.

AdjustRect Usage Tips:

  • Ensure that the scaling factors xm and ym are even numbers to maintain proper scaling and avoid unexpected results.
  • Use the round_mode parameter to control how the dimensions are rounded, which can help achieve more precise adjustments.
  • Verify that the input_format and output_format parameters are correctly set to match the coordinate formats you are working with.

AdjustRect Common Errors and Solutions:

Invalid scaling factor

  • Explanation: The scaling factors xm or ym are not even numbers.
  • Solution: Ensure that both xm and ym are set to even numbers to avoid this error.

Unsupported input or output format

  • Explanation: The specified input_format or output_format is not recognized.
  • Solution: Check the available formats and ensure that you are using a supported format for both input and output.

Coordinates out of bounds

  • Explanation: The adjusted coordinates fall outside the image boundaries.
  • Solution: Adjust the scaling factors or the initial coordinates to ensure that the resulting rectangle stays within the image boundaries.

AdjustRect Related Nodes

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