Image Resolution Cap
Cap resolution before anything touches your encoder
- image
- IMAGE
The most common way a local ComfyUI run dies isn't a bad prompt, it's a 4K screenshot quietly sliding into a CLIP encode or a VAE and blowing up your VRAM. ImageResolutionCap from the Rebalance Pack is the cheap insurance: it downscales an image only if it's over your cap, and leaves it alone otherwise. No blind resizing, no upscaling ever - just "make sure nothing bigger than this reaches the model."
In the pack's Krea 2 / Ideogram 4 edit workflows this is the node you put right before the text encoder or reference encode, because those take whatever you hand them and pay for it in memory. One node, one setting, and the "torch.OutOfMemoryError" stops being your hobby.
How it works
It compares your resolution_cap (default 2048) against the image and scales down proportionally only when needed, preserving aspect ratio. The cap_longest_side toggle (default on) means "longest side must be ≤ cap" - the usual interpretation. Flip it off and it caps the shortest side instead, which guarantees the whole image fits inside a square of cap on every side; that's the paranoid mode and it makes images smaller than you'd expect, but it's what you want when you must not exceed a hard budget.
The downscale_method dropdown offers area, lanczos, nearest-exact, bilinear, and bicubic. The default, area, is the right call for downscaling - it averages pixels and resists the moiré and shimmer you get from point-sampling large images down. It's what ComfyUI itself uses for resize-on-load for a reason.
The inputs that matter
- image - the tensor to police.
- resolution_cap (2048, range 16–16384) - your hard ceiling. Match it to your model's comfortable input, not your monitor.
- downscale_method - leave it on area unless you have a specific reason (lanczos if you're going up at some point, but this node never upscales).
- cap_longest_side - on for "no side over the cap," off for "whole image fits in a cap×cap box."
One output: IMAGE, the possibly-scaled tensor. That's the whole node - it's intentionally boring.
Install
Part of the Rebalance Pack. In ComfyUI Manager search "ComfyUI-Conditioning-Rebalance" (or "Rebalance Pack") and install. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/nova452/ComfyUI-ConditioningKrea2Rebalance
Restart afterwards. No models, no extra deps.
Where people get burned
The main gotcha is expecting it to upscale. It won't - if the image is under the cap, you get it back untouched, so don't use this as a resize-to-size node. Second: when a batch of images has wildly different sizes, this normalizes the ceiling but not the aspect ratios, so a 4:3 and a 9:16 image both get capped but stay different shapes. That's fine for feeding an encoder; it's not fine for building a training batch. For that, pair it with ImageAspectRatioCrop (ratio) or LoadImagesBlaze (uniform resize) from the same pack. And if you're capping a 16K panorama, remember the default 2048 cap is about VRAM safety, not about the model's ideal input - Krea 2 and friends often want bigger than 2048 for detail, so set the cap to what your card can actually hold rather than the default.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| resolution_cap | INT | 204816–16384 | — |
| downscale_method | COMBO | area | 5 options: area, lanczos, nearest-exact, bilinear, bicubic |
| cap_longest_side | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |