Nodes/comfyui-fitsize/Load Image And Resize To Fit (FS)
ComfyUI Node

Load Image And Resize To Fit (FS)

Paste an image, get a ready-to-sample latent

By bronkula·Created 3 years ago·Updated 2 years ago· 52
Load Image And Resize To Fit (FS)
  • vae
  • Latent
  • Image
  • Width
  • Height
  • Aspect Ratio
  • Mask
image
max_size768
resampling
upscale
batch_size1
add_noise0.00

The author's own description of this node is the best summary you'll get: "I decided that I wanted to just add in the image handling completely into one node." It's the standard ComfyUI Load Image node - paste-an-image-directly-in support included, no need to save a file first - fused with the pack's fit-and-resize logic and a VAE encode, all in one box. Where "Fit Image And Resize" expects you to already have an image in the graph, this one is the loading step too.

Why you'd reach for it

If you're starting an img2img workflow from a reference image, this collapses what's normally three or four nodes (Load Image → Resize → VAE Encode, plus maybe a mask pass) into one. You can literally paste a screenshot straight into it, the way you would with the default Load Image widget, and it comes out the other side as a correctly-sized latent ready for a KSampler. The README shows it dropped into the middle of workflows built around other node packs (Efficiency Nodes, in their example) specifically to demonstrate that it slots in cleanly as a drop-in replacement for the usual load-and-prep chain.

How it works

It's the pack's shared fit logic - scale the longer side to max_size, preserve aspect ratio, round to a multiple of 8 - applied right after loading, followed by a resample and a VAE encode into a latent batch. Because it also carries the standard mask editor that comes with ComfyUI's built-in image loading, it outputs a mask too, so you can paint or load a mask on the same image without a separate Load Image node just for that.

The inputs and outputs that matter

  • image - pick a file the normal ComfyUI way, or paste image data directly in (no save-to-disk step required).
  • vae (VAE) - must match your checkpoint's latent format; a mismatch produces bad output further down the graph rather than an error here.
  • max_size (INT, default 768, step 8) - target size for the image's longer side.
  • resampling - lanczos, nearest, bilinear, bicubic. Lanczos is the reasonable default for photos; nearest only if you're deliberately avoiding blending (pixel art).
  • upscale - false (default, shrink only) or true (also scales up small images).
  • batch_size (INT, default 1, max 64) - number of latent copies to produce, for running several sampler variations off one source image.
  • add_noise (FLOAT, default 0, 0–1) - adds noise to the image before encoding, for extra variation without pushing denoise too high.

Outputs: Latent (into your KSampler), Image (the resized pixels, un-encoded - handy for previews or compositing), Width, Height, Aspect Ratio, and Mask (from the built-in mask editor - feed it into an inpainting setup if you painted one).

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, no heavy dependency chain - this is a small pack that's just image math plus the standard load/VAE machinery ComfyUI already ships with. You'll find it under Fitsize → Image in the node browser.

Common issues

Because this node does the VAE encode itself, a wrong VAE is the most likely thing to bite you and it fails silently - no error, just washed-out or noisy output once you decode later. Match the VAE to your checkpoint's family.

For the img2img sampling step that follows, the README's own tip is worth following literally: start your KSampler's denoise around 0.5. Too low and you barely move from the source image; too high and you lose the resemblance you loaded the image for in the first place. And remember VAE round-trips are lossy - if you're chaining this node's output back through itself repeatedly (rather than a single pass), expect gradual quality loss each cycle, which is a property of encode/decode in general and not specific to this node.

One easy trip-up if you're new to it: because this node bundles the loader, it won't appear pre-filled with an image the way a workflow shared by someone else might expect - you'll need to paste or select your own image after loading the workflow JSON.

CategoryFitsize/Image

Inputs (7)

NameTypeDefaultDescription
vaeVAE
imageCOMBO1 options: example.png
max_sizeINT768
resamplingCOMBO4 options: lanczos, nearest, bilinear, bicubic
upscaleCOMBO2 options: false, true
batch_sizeINT11–64
add_noiseFLOAT0.000–1

Outputs (6)

NameTypeDescription
LatentLATENT
ImageIMAGE
WidthINT
HeightINT
Aspect RatioFLOAT
MaskMASK