Fit Size From Image (FS)
Measure an image, get back the numbers to resize it
- image
- Fit Width
- Fit Height
- Aspect Ratio
This one sits between "Fit Size From Int" and the pack's resize-and-output nodes: it takes a real image, reads its width and height off the tensor automatically, and does the same bounding-box fit math - but it never touches the pixels. You get numbers back, not a resized image.
That distinction is the entire point. If you just want the target dimensions an image would fit into, without paying for an actual resample, this is cheaper and simpler than any node that also outputs a new IMAGE. Feed those numbers into an EmptyLatentImage, a separate upscale node, or a report/log - whatever needs to know "how big should this end up" without needing the resized pixels themselves.
Why it exists
The author built this whole pack around a specific annoyance: pasting screenshots or reference images into ComfyUI and not wanting to think about what size or aspect ratio they came in at. This node is the "just tell me the target size" half of that idea - useful any time you're inspecting an image's dimensions mid-workflow and need the fitted numbers for something downstream that isn't a direct resize of that same image (for example, sizing a second, unrelated latent to match).
How it works
Same fitting math as the rest of the pack: the longer side gets scaled down to max_size, the shorter side scales proportionally, and the result rounds to multiples of 8 so it plays nicely with SD's latent grid. The only thing this node adds over "Fit Size From Int" is reading width/height off an incoming image automatically instead of making you type them in.
The inputs and outputs that matter
- image (IMAGE) - any image tensor. Its width and height get extracted for you; you don't set them.
- max_size (INT, default 768, step 8) - the cap for the longer dimension.
- upscale - false (default) or true. Off means the node only shrinks oversized images; on means it'll also scale a too-small image up to fill
max_size.
Outputs: Fit Width, Fit Height (INT), and Aspect Ratio (FLOAT) - same trio as "Fit Size From Int," just derived from a real image instead of typed numbers. Wire them anywhere a resolution or ratio is needed downstream.
Installing it
ComfyUI Manager: search "Comfy Fit Size" or "fitsize." Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/bronkula/comfyui-fitsize.git
Restart ComfyUI. No model downloads, no heavyweight dependencies - it's a lightweight image-math pack. Once installed, you'll find this under Fitsize → Numbers in the node picker.
Common issues
There's very little that can go wrong here specifically since it's read-only against the image and doesn't touch a VAE or write pixels. The usual suspects are generic: restart ComfyUI after cloning, and if you loaded a workflow from someone else before installing the pack, you'll see a missing-node error until you do. One thing worth knowing if you're chaining this with an actual resize node downstream: this node computes the fit but doesn't apply it, so if you want the resized image too, you'll want "Fit Size From Image" for the numbers and a separate resize step (or just use one of the pack's combined nodes, like "Fit Image And Resize," which does both at once).
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| max_size | INT | 768 | — |
| upscale | COMBO | 2 options: false, true |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| Fit Width | INT | — |
| Fit Height | INT | — |
| Aspect Ratio | FLOAT | — |