TS Get Image Size
The longer side or the shorter side — pick one
- image
- size
Most image-resize workflows don't care about width and height - they care about the longest side ("max 1024, whatever the other side becomes") or the shortest side ("at least 768"). TS Get Image Size answers exactly that: it returns the longer or the shorter side of an image as an INT, and a boolean decides which one you get.
It's the measurement companion to resize-by-side workflows, and it's the kind of node that quietly saves you from writing conditional math. Landscape and portrait images both get handled by the same logic because the "size" is defined by side length, not orientation. If you've ever had a workflow break because it assumed width was the big dimension, you know why this exists.
How it works
Read the image's dimensions, compare them, return the appropriate one as an INT. The large_side boolean is the entire config: true returns the longer side, false returns the shorter. So a 2048×1024 landscape gives 2048 with large_side=true and 1024 with large_side=false; a 1024×2048 portrait gives the same numbers. Orientation-independent, which is the point.
One input (image), one output (size, an INT). No list, no batch handling - like its megapixel sibling, it measures a single image, not a whole batch.
Installing it
Part of comfyui-timesaver (ComfyUI Manager → "Timesaver", or manual clone + pip install -r requirements.txt + restart). No models, nothing to configure beyond the boolean.
Where you'll use it
The classic pattern is feeding a resize node that takes a "longer side" or "shorter side" target: measure the current side, feed it back with the resize delta applied, and you've built a relative resize ("make it 2× longer") out of absolute-target nodes. It's also the standard answer for "is this image landscape or portrait?" - compare the two sides, or just check whether the longer side equals the width. And in video pipelines it's handy for normalizing frame sizes before a node that demands a specific side be under a threshold.
Gotchas
Two small things. First, it's an INT output, so it feeds integer sockets directly - no conversion needed, which is a genuine convenience compared to the FLOAT of the megapixels node. Second, if you're building the "orientation test," comparing against width requires a second node (there's no width-vs-height output here) - this gives you one side, not both. For that you'd grab both dimensions elsewhere. And as with its sibling, a batch input still returns per-frame dimensions - one frame's side, not a batch-wide value.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image whose dimensions are measured. | |
| large_side | BOOLEAN | true | If enabled, returns the longer side; otherwise the shorter side. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| size | INT | Length in pixels of the selected side (larger or smaller). |