ComfyUI > Nodes > comfy_PoP > AnyAspectRatio

ComfyUI Node: AnyAspectRatio

Class Name

AnyAspectRatio

Category
PoP
Author
picturesonpictures (Account age: 1261days)
Extension
comfy_PoP
Latest Updated
2026-03-13
Github Stars
0.02K

How to Install comfy_PoP

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

AnyAspectRatio Description

Calculates precise dimensions from aspect ratios, ensuring consistent image proportions.

AnyAspectRatio:

The AnyAspectRatio node is designed to help you calculate precise width and height dimensions based on specified aspect ratios. This node is particularly useful when you need to maintain a specific aspect ratio for your images or designs, ensuring that the proportions are consistent and visually appealing. By inputting width and height ratios, along with a desired side length, the node computes the corresponding dimensions, rounding them to the nearest specified value. This functionality is essential for artists and designers who require exact dimensions for their projects, allowing for flexibility and precision in maintaining aspect ratios across various media.

AnyAspectRatio Input Parameters:

width_ratio

The width_ratio parameter defines the horizontal component of the aspect ratio. It determines how wide the resulting image will be in relation to the height. The default value is 16, with a minimum of 1 and a maximum of 4096. Adjusting this value will directly impact the width of the output, allowing you to tailor the aspect ratio to your specific needs.

height_ratio

The height_ratio parameter specifies the vertical component of the aspect ratio. It controls the height of the resulting image relative to the width. The default value is 9, with a minimum of 1 and a maximum of 4096. Modifying this parameter will affect the height of the output, enabling you to achieve the desired aspect ratio for your project.

side_length

The side_length parameter represents the base length from which the total pixel area is calculated. It serves as a reference for determining the overall size of the output dimensions. The default value is 1024, with a range from 1 to 4096. This parameter is crucial for scaling the dimensions while maintaining the specified aspect ratio.

rounding_value

The rounding_value parameter is used to round the calculated width and height to the nearest multiple of this value. This ensures that the dimensions are practical and compatible with certain requirements, such as hardware constraints or aesthetic preferences. The default value is 64, with a minimum of 1 and a maximum of 4096. Adjusting this value can help you achieve more precise or standardized dimensions.

AnyAspectRatio Output Parameters:

width

The width output parameter provides the calculated width of the image based on the input aspect ratio and side length. This value is rounded to the nearest multiple of the rounding_value, ensuring that it meets any specific requirements you may have. The width is a crucial component in maintaining the desired aspect ratio and is essential for achieving the correct proportions in your design.

height

The height output parameter delivers the calculated height of the image, derived from the input aspect ratio and side length. Like the width, this value is rounded to the nearest multiple of the rounding_value, ensuring compatibility with your needs. The height is vital for preserving the intended aspect ratio, allowing you to create images with the correct vertical proportions.

AnyAspectRatio Usage Tips:

  • To maintain a standard widescreen aspect ratio, use a width_ratio of 16 and a height_ratio of 9, which is ideal for video and digital content.
  • If you need to create square images, set both width_ratio and height_ratio to 1, ensuring equal width and height dimensions.

AnyAspectRatio Common Errors and Solutions:

Invalid aspect ratio values

  • Explanation: If the width_ratio or height_ratio is set outside the allowed range (1 to 4096), the node may not function correctly.
  • Solution: Ensure that both width_ratio and height_ratio are within the specified range to avoid calculation errors.

Rounding value too large

  • Explanation: Setting a rounding_value larger than the calculated dimensions can result in unexpected outputs.
  • Solution: Choose a rounding_value that is smaller than or equal to the smallest dimension to ensure proper rounding.

AnyAspectRatio Related Nodes

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

AnyAspectRatio