Visit ComfyUI Online for ready-to-use ComfyUI environment
Calculate and output image aspect ratio as smallest integer ratio for maintaining visual consistency and precision in projects.
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.
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.
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.
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.
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.
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.
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.
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.
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.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.Resolution
output to ensure the aspect ratio applied matches your design requirements, especially when working with multiple images in a project.<minimum_ratio_str>
aspect_ratio
parameter to a value that meets the minimum ratio requirement, or modify the image dimensions to fit within the acceptable range.<maximum_ratio_str>
aspect_ratio
that falls within the permissible range, or resize the image to comply with the maximum ratio constraints.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.