Fit Image And Resize (FS)
The mid-workflow img2img prep node
- image
- vae
- Latent
- Image
- Fit Width
- Fit Height
- Aspect Ratio
This is the pack's img2img workhorse, and it's the node the README gets visibly more excited about: "Now this is where things get interesting." Feed it an image you already have in the graph plus a VAE, and it fits the image to a max size, resamples it, and VAE-encodes the result straight to a latent - one node instead of three or four. That's a real time-saver if you're building an img2img chain and don't want a Resize → VAEEncode pair cluttering the graph every time.
Where it fits in a workflow
The typical case: you generated an image, or loaded one from disk with the plain ComfyUI Load Image node, and now you want to run it back through a KSampler for a second pass - restyling, refining, or just varying it. Normally that's a resize node feeding a VAE Encode node feeding your sampler. This node collapses that into one box: image and VAE go in, a properly-sized latent (plus the resized image itself, and its dimensions) comes out, ready to plug into a KSampler with denoise set below 1.0.
The README is specific about that setting, and it's worth repeating because it's the single most useful tip in the whole pack: set denoise around 0.5 as your starting point. Lower keeps you close to the original image; higher lets the sampler deviate more; go too high and you'll get something only loosely related to what you fed in.
How it works
Same fitting math the whole pack shares - longest side scaled to max_size, aspect ratio preserved, result rounded to a multiple of 8 so the output lines up with SD's latent grid - followed by a resample using whichever filter you pick, then a VAE encode of the resized pixels into a latent batch.
The inputs and outputs that matter
- image (IMAGE) - the source image, already in your graph (this node doesn't load files itself - that's what "Load Image And Resize To Fit" is for).
- vae (VAE) - needs to match the checkpoint you'll sample with. A mismatched VAE won't error loudly; it'll just decode to garbage or washed-out color later, so keep the VAE tied to the same model family as your sampler.
- max_size (INT, default 768, step 8) - target size for the longer side.
- resampling -
lanczos,nearest,bilinear, orbicubic. Lanczos is the safe general-purpose default; nearest is only useful for pixel art where you don't want any blending. - upscale - false (default, shrink-only) or true (also scales up undersized images).
- batch_size (INT, default 1, max 64) - how many copies of the latent to produce. Bump this if you want several sampler variations from the same source image in one run.
- add_noise (FLOAT, default 0, 0–1) - adds noise directly to the image before encoding, which the README recommends as a way to push further iteration variety without cranking denoise so high you lose the source entirely.
Outputs: Latent (feed straight to your KSampler), Image (the resized pixels, not VAE-encoded - useful for previewing or compositing), Fit Width, Fit Height, and Aspect Ratio.
Installing it
ComfyUI Manager: search "Comfy Fit Size" or "fitsize." Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/bronkula/comfyui-fitsize.git
Restart ComfyUI. No model downloads and nothing heavy to install - it's a small, self-contained pack. You'll find this node under Fitsize → Image.
Common issues
The VAE match matters more here than in most nodes, because this one does the encode for you silently - if you wire in a VAE from a different model family than the checkpoint you're about to sample with, you won't get an error, you'll get bad output (washed-out color or noise) further down the graph, which is a much harder thing to debug than a red node. Keep the VAE and checkpoint paired.
The other thing to know: VAE encode/decode is inherently lossy, so if this node sits in a loop you're running repeatedly (encode, sample, decode, feed back in, encode again), image quality erodes a little each pass - that's a property of the VAE round-trip itself, not a bug in this node. For a one-shot img2img pass it's a non-issue; for iterative refinement chains, it's worth knowing why quality creeps down over many cycles.
And the same denoise guidance from the README applies regardless of what's feeding this node: start around 0.5 in your KSampler and adjust from there rather than guessing at the extremes.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| vae | VAE | — | |
| max_size | INT | 768 | — |
| resampling | COMBO | 4 options: lanczos, nearest, bilinear, bicubic | |
| upscale | COMBO | 2 options: false, true | |
| batch_size | INT | 11–64 | — |
| add_noise | FLOAT | 0.000–1 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| Latent | LATENT | — |
| Image | IMAGE | — |
| Fit Width | INT | — |
| Fit Height | INT | — |
| Aspect Ratio | FLOAT | — |