Nodes/comfyui-moonpack/Proportional Dimension
ComfyUI Node

Proportional Dimension

Resizes width/height proportionally so the chosen side hits target_size, snapping to a multiple via nearest/floor/ceil rounding.

By moonwhaler·Created about a year ago·Updated 24 days ago· 15
Proportional Dimension
  • from_image
  • width
  • height
  • shortest_side
  • longest_side
  • scale
width1440
height1024
target_size480
target_sideshortest
orientationauto
divisible_by1
roundingnearest
CategoryMoonPack/image

Inputs (8)

NameTypeDefaultDescription
widthINT14401–16384Original width in pixels.
heightINT10241–16384Original height in pixels.
target_sizeINT4801–16384Desired size for the selected side.
target_sideCOMBOshortestWhich side target_size applies to. 'shortest' upscales the smaller side; 'longest' caps the larger side.
orientationCOMBOautoForce output orientation. 'auto' keeps source orientation. 'landscape'/'portrait' swap width/height when source doesn't match. 'square' produces target_size x target_size (ignores target_side).
divisible_byINT11–1024Snap output dimensions to a multiple of this value (1 = no snapping).
roundingCOMBOnearestHow to snap to the divisor. 'floor' guarantees output ≤ ideal; 'ceil' guarantees ≥.
from_imageoptIMAGEOptional: read width/height from an IMAGE tensor instead of the widgets.

Outputs (5)

NameTypeDescription
widthINT
heightINT
shortest_sideINT
longest_sideINT
scaleFLOAT