floyo logobeta logo
Powered by
ThinkDiffusion
floyo logobeta logo
Powered by
ThinkDiffusion

ComfyUI_AspectRatioToSize

2

Last updated
2025-06-04

A custom node for ComfyUI that calculates image dimensions while preserving the specified aspect ratio, this tool simplifies the process of determining image resolutions based on defined aspect ratios and longer side values. It streamlines workflows for users who need precise control over image sizes in their projects.

  • Facilitates the calculation of width and height based on any given aspect ratio and longer side dimension.
  • Outputs a size object that includes both width and height, along with the longer and shorter side dimensions.
  • Computes the necessary padding to adjust an image to a specified aspect ratio, enhancing image presentation.

Context

This tool is designed for use within ComfyUI, serving the purpose of accurately calculating image sizes while maintaining the desired aspect ratio. It is particularly useful for artists and developers who require precise image dimensions for their projects without the hassle of manual calculations.

Key Features & Benefits

The primary feature of this tool is its ability to compute the width and height of an image based on a specified aspect ratio and the length of the longer side. This automated calculation saves time and minimizes errors, allowing users to focus on creative aspects rather than tedious math. Additionally, it provides a size object that includes all relevant dimensions, making it easy to integrate into various workflows.

Advanced Functionalities

This tool includes advanced capabilities such as calculating the required padding to fit an image into a specific aspect ratio. Users can input an image and desired aspect ratio, and the tool will return the necessary padding values for each side, ensuring that images are displayed correctly without distortion.

Practical Benefits

By automating the calculation of image dimensions and padding, this tool enhances workflow efficiency and control. Users can quickly determine the exact size of images required for their projects, significantly improving the quality of the output and reducing the time spent on adjustments.

Credits/Acknowledgments

This tool was developed by contributors to the ComfyUI community and is available under an open-source license, fostering collaboration and continuous improvement in the field of AI art workflows.