Nodes/ComfyUI_StarNodes/⭐ Star Size Calculator by Side
ComfyUI Node

⭐ Star Size Calculator by Side

Star Size Calculator by Side — resize math you never have to do again

By Starnodes2024·Created 2 years ago·Updated 2 days ago· 106
⭐ Star Size Calculator by Side
  • image
  • width_str
  • width_int
  • height_str
  • height_int
  • long_side_str
  • long_side_int
  • short_side_str
  • short_side_int
use_input_imagetrue
target_size1024
resize_by_side
width1024
height1024

"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_image on (default): connect an image and it reads the dimensions straight from it. No manual typing, no mistakes.
  • use_input_image off: you supply width and height manually.

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_int and short_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.

Category⭐StarNodes/Helpers And Tools

Inputs (6)

NameTypeDefaultDescription
use_input_imageBOOLEANtrue
target_sizeINT10241–16384
resize_by_sideCOMBO2 options: Longest, Shortest
imageoptIMAGE
widthoptINT10241–16384
heightoptINT10241–16384

Outputs (8)

NameTypeDescription
width_strSTRING
width_intINT
height_strSTRING
height_intINT
long_side_strSTRING
long_side_intINT
short_side_strSTRING
short_side_intINT