ImageRatio(imageRatio)
The ImageRatio node extracts geometric properties from an input image.
image Ratio
Description
The ImageRatio node extracts geometric properties from an input image. It returns the image width and height in pixels, followed by two floating-point aspect ratio values. It does not modify or transform the image, making it useful for passing dimensions and ratios to other nodes in a workflow.
Inputs
image
- Type:
IMAGE - Required: Yes
A standard ComfyUI image tensor. The node reads its spatial dimensions from the tensor shape.
Outputs
The node returns four values in a fixed order:
- INT — Width of the image in pixels.
- INT — Height of the image in pixels.
- FLOAT — Width-to-height aspect ratio (
width / height). - FLOAT — Height-to-width aspect ratio (
height / width).
The first integer represents the horizontal pixel dimension, and the second represents the vertical pixel dimension. The floating-point outputs express the same relationship in both directions, so either ratio can be used depending on the downstream node's convention.
Usage Notes
- The node is purely read-only: it only inspects the image tensor and returns numbers.
- All images in a batch are expected to share the same spatial dimensions, so the returned values describe the whole batch.
- The node is useful for sizing latents, conditioning, or other nodes that require explicit width and height values rather than an image tensor.
Comments
Sign in with GitHub to join the discussion.