Ratio Calculator 988:
Legacy version: This page documents RatioCalc988 at upstream commit b7a23efee0e3686171863899f1ec93ba9d948220. The node has been removed from the current extension. Its availability and interface here apply to that historical revision, not the latest release.
RatioCalc988 identifies the aspect-ratio preset that most closely matches an image’s width-to-height proportions. It compares the image’s proportions with a fixed set of landscape, square, and portrait presets, then displays the closest preset label. This helps you choose a matching format elsewhere in an image workflow without calculating the ratio yourself. The result is the nearest available preset, so it may not describe the image’s exact proportions.
Ratio Calculator 988 Input Parameters:
image
The required IMAGE to analyze. The node reads its width and height to determine the closest aspect-ratio preset; the image’s visual content does not affect the result. Connect an image-producing node here. The source specifies no default value, minimum, maximum, or selectable options for this input.
Ratio Calculator 988 Output Parameters:
ratio
The closest matching aspect-ratio label, such as 16:9 ▭ for an image with 16:9 proportions. The available labels cover square, landscape, and portrait presets, ranging from 9:32 ▯ through 32:9 ▭; the source also contains an empty-label entry, but its identical 1:1 proportions appear after the named 1:1 ◻ entry and do not replace that earlier match. Although the output socket is declared with a wildcard type, the implementation returns a label string. It also displays that label as text on the node.
Ratio Calculator 988 Usage Tips:
- Connect the image whose dimensions you want to classify, then use the displayed label or the
ratiooutput when selecting a corresponding preset later in your workflow. - An exact match is not required. For example, a 1920 × 1080 image has 16:9 proportions and returns
16:9 ▭; an image between presets returns whichever preset has the smallest width-to-height ratio difference. - There are no exposed settings to tune. If you need a different result, change the image’s dimensions before passing it to this node. Changing the depicted subject or other visual details will not change the ratio.
Ratio Calculator 988 Common Errors and Solutions:
Required input is missing
- Explanation: If
imageis unconnected, the workflow cannot provide the required image. The exact validation message depends on the host. - Solution: Connect an
IMAGEoutput toimageand run the workflow again.
ValueError: not enough values to unpack (expected 4, got 3)
- Explanation: The implementation expects image data with four dimensions: batch, height, width, and channels. A three-dimensional value does not match that shape.
- Solution: Feed the node a standard
IMAGEoutput from a compatible image node rather than manually reshaped image data.
ValueError: too many values to unpack (expected 4)
- Explanation: Image data with more than four dimensions does not match the shape the node expects.
- Solution: Remove the extra dimension upstream or use a compatible
IMAGEoutput.
ZeroDivisionError: integer division or modulo by zero
- Explanation: A zero-width or zero-height image can cause the width-and-height calculation to divide by zero. Such dimensions are not usable for an aspect-ratio comparison.
- Solution: Check the upstream image source and provide an image with nonzero width and height.
