⭐ Star Size Calculator by Side
Star Size Calculator by Side — resize math you never have to do again
- image
- width_str
- width_int
- height_str
- height_int
- long_side_str
- long_side_int
- short_side_str
- short_side_int
"How big does the other side become if I make the long side 1024?" Every ComfyUI user has done this arithmetic in their head, or worse, in a calculator tab, about a thousand times. Star Size Calculator by Side is the answer to that reflex: feed it a target size and tell it whether you're resizing the longest or shortest side, and it hands you both dimensions plus the aspect ratio - as both integers and strings, so you can wire them into either a latent node or a text prompt.
What it does
The core is one decision: resize_by_side set to Longest or Shortest, and a target_size (1–16384). Pick "Longest" and it scales so the longer edge hits the target, preserving aspect ratio - the standard way to shrink something to fit. Pick "Shortest" and it scales so the shorter edge hits the target - the way you bring a small image's short side up to a workable minimum without exploding the long side past what your VRAM will swallow.
It can work two ways:
use_input_imageon (default): connect animageand it reads the dimensions straight from it. No manual typing, no mistakes.use_input_imageoff: you supplywidthandheightmanually.
Either way it also exposes the target side as long_side / short_side outputs, so you can grab "what will the long side be" even when you resized by the short side.
Inputs and outputs
Inputs: use_input_image, target_size, resize_by_side, and optionally image or width/height.
Outputs - and this is the part that makes it useful in more than one place:
width_str/height_str- strings, for dropping into text or filename templates.width_int/height_int- integers, for the numeric inputs of latent and resize nodes.long_side_str/long_side_intandshort_side_str/short_side_int- the corresponding values as both types.
The duplicated string/int outputs look like overkill until you've spent ten minutes fighting a node that only accepts an INT while your workflow only produces strings. Here you get both, free.
Where it sits in a workflow
The classic pattern is feeding a resize or a latent node: Star Size Calculator by Side → width_int/height_int → a Resize or Empty Latent. Combined with the pack's Star Divisible Dimension, you can compute a size, snap it to a multiple, and hand it downstream - no manual math at any point.
Installing
Part of StarNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
cd ComfyUI_StarNodes
pip install -r requirements.txt
Restart and search star - it's under ⭐StarNodes/Helpers And Tools. Manager users: search "Starnodes".
Gotchas
It computes, it doesn't resize - remember to actually connect the dimensions to a resize node, because the calculator alone changes nothing. And if you leave use_input_image on but forget to connect an image, it silently falls back to the manual width/height inputs, which is convenient but easy to mistake for the calculator ignoring you. One nice touch: the string and int outputs always agree, so pick whichever type your next node accepts and stop converting by hand.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| use_input_image | BOOLEAN | true | — |
| target_size | INT | 10241–16384 | — |
| resize_by_side | COMBO | 2 options: Longest, Shortest | |
| imageopt | IMAGE | — | |
| widthopt | INT | 10241–16384 | — |
| heightopt | INT | 10241–16384 | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| width_str | STRING | — |
| width_int | INT | — |
| height_str | STRING | — |
| height_int | INT | — |
| long_side_str | STRING | — |
| long_side_int | INT | — |
| short_side_str | STRING | — |
| short_side_int | INT | — |