Resize To Fit
The node that keeps every frame the same size
- image
- Image
The optical-flow nodes in this pack demand matching frame sizes, and ComfyUI gives you no guarantee that two images from different places are the same resolution. ResizeToFit is the boring, essential referee: it resizes an image so its longest side fits a target while keeping the aspect ratio, and it snaps the result to a multiple you choose. That last part is why it exists - diffusion models and the VAE are happiest (and only fully correct) on dimensions divisible by 8, ideally 64.
The mechanism is straightforward bilinear interpolation via torch.nn.functional.interpolate, with the dimensions rounded down to your divisible_by value. If your frame is 1000×750 and you set max_size to 1280 with divisible_by 64, it scales to 1280×960 - not 1280×960.001, not 1000×750 with padding. It fits and snaps. Nothing is cropped and nothing is letterboxed; content is just downscaled (or upscaled, if the image is smaller than the target).
Inputs
image- anything with an IMAGE type. In ComfyWarp you'll most often put this right after a frame loader to normalize the clip before flow extraction.max_size(default 1280) - the longest-side target. 1280 is a solid default for SDXL-era models; drop to 1024 or 768 if VRAM is tight.divisible_by(default 64) - the alignment requirement. 64 for SDXL/Flux-style models; 8 is the minimum the pack's own loaders use. The node enforces a floor of 2.
The gotcha worth knowing
This only takes one image at a time (a single frame), and it resizes proportionally - so frames that arrived with different aspect ratios will stay different aspect ratios, just scaled to the same longest side. If your source frames have inconsistent dimensions (some 16:9, some 4:3), ResizeToFit won't unify them; it'll hand you consistently-sized-but-still-mismatched shapes. The real fix for that is to extract your dataset at a uniform resolution (MakeFrameDataset's extraction, plus a consistent fit_into in the pair loader). For everything else - matching your init image to the sampler's working resolution, prepping a source frame for flow, keeping a still from a different pipeline the same size as the clip - this is the quiet little node that prevents half your "dimension mismatch" errors.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| max_size | INT | 12800–9999999999 | — |
| divisible_by | INT | 642–2048 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Image | IMAGE | — |