ComfyUI > Nodes > ComfyUI_StarNodes > ⭐ Starnodes Aspect Ratio Advanced

ComfyUI Node: ⭐ Starnodes Aspect Ratio Advanced

Class Name

Starnodes_Aspect_Ratio_Advanced

Category
⭐StarNodes/Image And Latent
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 Advanced Description

Calculate and output image aspect ratio in simplified format, compute dimensions based on megapixel count, generate latent representations for Flux/SDXL and SD3.5 models.

⭐ Starnodes Aspect Ratio Advanced:

The Starnodes_Aspect_Ratio_Advanced node is designed to enhance your image processing workflow by calculating and outputting the aspect ratio of an image in a simplified integer format, such as '3x4'. This node not only provides the aspect ratio but also computes the dimensions based on a specified megapixel count, ensuring that your images maintain the desired resolution. Additionally, it offers advanced functionality by generating latent representations for different models like Flux/SDXL and SD3.5, which are crucial for further image processing tasks. This node is particularly beneficial for AI artists who need to maintain specific aspect ratios and resolutions while working with various image models, providing a seamless and efficient way to manage image dimensions and latent space requirements.

⭐ Starnodes Aspect Ratio Advanced Input Parameters:

image

This optional parameter allows you to input an image for which the aspect ratio will be calculated. If provided, the node can determine the nearest predefined aspect ratio to the image's actual ratio, enhancing the accuracy of the output dimensions.

aspect_ratio

This required parameter lets you select from a list of predefined aspect ratios, excluding the 'Free Ratio'. It determines the target aspect ratio for the output dimensions. The available choices are loaded from a configuration file, ensuring flexibility and adaptability to various artistic needs.

megapixel

This parameter specifies the desired resolution in megapixels for the output image. It influences the total number of pixels in the output dimensions, with options ranging from 0.1 to 4.0 megapixels. The default value is set to 1.0 megapixels, providing a balance between image quality and processing efficiency.

use_nearest_from_image

A boolean parameter that, when set to true, enables the node to automatically select the closest predefined aspect ratio to the input image's actual aspect ratio. This feature is particularly useful when working with images of varying dimensions, ensuring consistency in output.

batch_size

This parameter defines the number of images to process simultaneously, with a default value of 1. It supports a range from 1 to 4096, allowing for batch processing of images, which can significantly speed up workflows when dealing with large datasets.

⭐ Starnodes Aspect Ratio Advanced Output Parameters:

width

This output provides the calculated width of the image based on the selected aspect ratio and megapixel count. It is an integer value that represents the horizontal dimension of the output image.

height

This output gives the calculated height of the image, complementing the width to maintain the specified aspect ratio. It is an integer value representing the vertical dimension of the output image.

Resolution

This output is a string that combines the width and height into a readable format, such as '1920 x 1080', providing a quick reference to the image's dimensions.

SDXL / FLUX

This output provides a latent representation of the image for use with the Flux/SDXL model. It is a tensor with dimensions adjusted to fit the model's requirements, facilitating further processing in the latent space.

SD3.5

Similar to the SDXL / FLUX output, this provides a latent representation tailored for the SD3.5 model. It ensures compatibility with the model's input specifications, enabling seamless integration into your image processing pipeline.

⭐ Starnodes Aspect Ratio Advanced Usage Tips:

  • Utilize the use_nearest_from_image parameter to automatically adjust the aspect ratio based on the input image, ensuring that your output dimensions are as close as possible to the original image's proportions.
  • Experiment with different megapixel settings to find the optimal balance between image quality and processing speed, especially when working with high-resolution images.

⭐ Starnodes Aspect Ratio Advanced Common Errors and Solutions:

Unsupported image type for aspect ratio calculation

  • Explanation: This error occurs when the input image is of a type that the node cannot process.
  • Solution: Ensure that the image is either a NumPy array with a shape attribute or a PIL Image object. Convert other image types to one of these formats before inputting them into the node.

ValueError: Invalid aspect ratio key

  • Explanation: This error is raised when an aspect ratio key that does not exist in the predefined list is used.
  • Solution: Verify that the aspect ratio key is correctly selected from the available options provided by the node. Double-check the configuration file for the correct list of aspect ratios.

⭐ Starnodes Aspect Ratio Advanced 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.