ComfyUI > Nodes > ComfyUI_StarNodes > ⭐ Starnodes Aspect Ratio

ComfyUI Node: ⭐ Starnodes Aspect Ratio

Class Name

Starnodes_Aspect_Ratio

Category
⭐StarNodes/Helpers And Tools
Author
Starnodes2024 (Account age: 326days)
Extension
ComfyUI_StarNodes
Latest Updated
2025-05-10
Github Stars
0.04K

How to Install ComfyUI_StarNodes

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

⭐ Starnodes Aspect Ratio Description

Calculate and output image aspect ratio as smallest integer ratio for maintaining visual consistency and precision in projects.

⭐ Starnodes Aspect Ratio:

The Starnodes_Aspect_Ratio node is designed to help you determine and work with the aspect ratio of images in a straightforward manner. Its primary function is to take an image input and output its aspect ratio as a string, reduced to the smallest integer ratio. This node is particularly useful for artists and designers who need to maintain specific aspect ratios in their work, ensuring consistency and precision in their visual outputs. By providing a simple method to calculate and apply aspect ratios, this node enhances your workflow efficiency and helps you achieve the desired visual balance in your projects.

⭐ Starnodes Aspect Ratio Input Parameters:

aspect_ratio

The aspect_ratio parameter allows you to select from a predefined list of aspect ratios, excluding the 'Free Ratio' option. This selection determines the target aspect ratio that the node will use to process the image. Choosing the correct aspect ratio is crucial for maintaining the intended visual proportions in your artwork.

megapixel

The megapixel parameter specifies the desired resolution of the output image in terms of megapixels. It offers a range of choices from 0.1 to 4.0, with a default value of 1.0. This parameter impacts the total number of pixels in the output image, influencing both the image quality and file size. Selecting a higher megapixel value results in a higher resolution image, which is beneficial for detailed work but may increase processing time and file size.

use_nearest_from_image

The use_nearest_from_image parameter is a boolean option that, when enabled, allows the node to automatically find and use the aspect ratio closest to the input image's actual dimensions. This feature is particularly useful when working with images of unknown or non-standard aspect ratios, as it helps maintain visual consistency by selecting the most appropriate predefined ratio.

image

The image parameter is an optional input that allows you to provide an image file for which the aspect ratio will be calculated. If an image is provided, the node will analyze its dimensions to determine the aspect ratio, which can then be used in conjunction with the other parameters to achieve the desired output.

⭐ Starnodes Aspect Ratio Output Parameters:

width

The width output parameter provides the calculated width of the image based on the selected aspect ratio and megapixel settings. This value is essential for understanding the horizontal dimension of the output image and ensuring it aligns with your design requirements.

height

The height output parameter gives the calculated height of the image, complementing the width parameter. Together, these dimensions define the overall size of the output image, allowing you to maintain the desired aspect ratio and resolution.

Resolution

The Resolution output parameter is a string representation of the aspect ratio, expressed in the simplest integer form (e.g., '3x4'). This output is useful for quickly verifying the aspect ratio applied to the image, ensuring it matches your expectations and design specifications.

⭐ Starnodes Aspect Ratio Usage Tips:

  • Use the use_nearest_from_image option when working with images of unknown dimensions to automatically select the closest predefined aspect ratio, ensuring consistency in your project.
  • Adjust the megapixel parameter based on the desired output quality and file size. Higher values provide better quality but may require more processing power and storage space.
  • Verify the Resolution output to ensure the aspect ratio applied matches your design requirements, especially when working with multiple images in a project.

⭐ Starnodes Aspect Ratio Common Errors and Solutions:

Unsupported image type for aspect ratio calculation

  • Explanation: This error occurs when the provided image is of a type that the node cannot process to determine its dimensions.
  • Solution: Ensure that the image input is either a NumPy array with a valid shape or a PIL Image object. Convert the image to a supported format if necessary.

Aspect ratio cannot reduce to any less than <minimum_ratio_str>

  • Explanation: This error indicates that the calculated aspect ratio is smaller than the minimum allowed ratio.
  • Solution: Adjust the aspect_ratio parameter to a value that meets the minimum ratio requirement, or modify the image dimensions to fit within the acceptable range.

Aspect ratio cannot reduce to any greater than <maximum_ratio_str>

  • Explanation: This error signifies that the calculated aspect ratio exceeds the maximum allowed ratio.
  • Solution: Select a different aspect_ratio that falls within the permissible range, or resize the image to comply with the maximum ratio constraints.

⭐ Starnodes Aspect Ratio Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_StarNodes
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 Playground, enabling artists to harness the latest AI tools to create incredible art.