ComfyUI > Nodes > ComfyUI-UniversalToolkit > Image Ratio Detector (UTK)

ComfyUI Node: Image Ratio Detector (UTK)

Class Name

ImageRatioDetector_UTK

Category
UniversalToolkit/Image
Author
whmc76 (Account age: 1110days)
Extension
ComfyUI-UniversalToolkit
Latest Updated
2026-03-16
Github Stars
0.07K

How to Install ComfyUI-UniversalToolkit

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

Image Ratio Detector (UTK) Description

ImageRatioDetector_UTK analyzes image aspect ratios, aiding in design consistency and format alignment.

Image Ratio Detector (UTK):

The Image Ratio Detector (UTK) is a specialized node designed to analyze and determine the aspect ratio of an image. This node is particularly useful for AI artists and designers who need to understand the proportions of their images for various creative and technical purposes. By calculating the aspect ratio, the node helps in maintaining consistency across different visual elements and ensures that images are displayed correctly on various platforms. The node not only provides the exact aspect ratio but also suggests the closest standard aspect ratio, making it easier for users to align their images with common formats. This functionality is crucial for tasks such as image scaling, cropping, and layout design, where aspect ratio plays a significant role in the visual outcome.

Image Ratio Detector (UTK) Input Parameters:

image

The image parameter is the sole input for the Image Ratio Detector node. It expects an image object, which can be in various formats, including tensors with dimensions that the node can interpret. The function of this parameter is to provide the node with the image data necessary for calculating the aspect ratio. The image should be in a format that the node can process, typically a tensor with dimensions that represent the image's height, width, and channels. There are no specific minimum, maximum, or default values for this parameter, as it depends on the image being analyzed. However, the image must be valid and non-empty for the node to function correctly.

Image Ratio Detector (UTK) Output Parameters:

ratio_str

The ratio_str output parameter provides the exact aspect ratio of the image in a simplified string format, such as "16:9" or "4:3". This output is crucial for understanding the precise proportions of the image, which can be used for further processing or decision-making in design tasks.

width

The width output parameter returns the width of the image in pixels. This value is important for understanding the horizontal dimension of the image and is often used in conjunction with the height to calculate or verify the aspect ratio.

height

The height output parameter returns the height of the image in pixels. Similar to the width, this value is essential for understanding the vertical dimension of the image and is used to calculate or verify the aspect ratio.

approx_ratio_str

The approx_ratio_str output parameter provides the closest standard aspect ratio to the calculated aspect ratio of the image. This output is particularly useful for aligning images with common aspect ratios used in various media and design standards, ensuring compatibility and consistency.

Image Ratio Detector (UTK) Usage Tips:

  • Ensure that the image input is in a compatible format, such as a tensor with appropriate dimensions, to avoid processing errors.
  • Use the approx_ratio_str output to quickly align your images with standard aspect ratios, which can be beneficial for maintaining consistency across different projects or platforms.
  • Consider using this node in conjunction with other image processing nodes to automate workflows that require aspect ratio adjustments or validations.

Image Ratio Detector (UTK) Common Errors and Solutions:

Invalid image format

  • Explanation: The image provided is not in a format that the node can process, such as an incorrect tensor dimension.
  • Solution: Ensure that the image is a valid tensor with dimensions that represent the image's height, width, and channels. Convert the image to a compatible format if necessary.

Zero width or height

  • Explanation: The image has a width or height of zero, which makes it impossible to calculate an aspect ratio.
  • Solution: Verify that the image is not empty and has valid dimensions. Check the source of the image to ensure it is correctly loaded and processed before inputting it into the node.

Image Ratio Detector (UTK) Related Nodes

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

Image Ratio Detector (UTK)