EmAySee Conditional Resize
Only resize the small ones — the upscale gate that leaves big images alone
- image
- IMAGE
Most resize nodes resize, full stop. EmAySee Conditional Resize is the picky one: if your image's longest side is already at or above a threshold, it passes the image through untouched. Only if it's smaller does it upscale - and it scales to a resolution you choose. It's an upscaler with a bouncer at the door.
The use case is batch workflows with mixed inputs. Feed it ten images from different sources - some 512px thumbnails, some already 2048px - and instead of a resize node stretching everything to one size (or an upscaler wasting VRAM doubling an already-huge image), this one fixes only the undersized frames and leaves the big ones alone. It's a "normalize to a minimum quality" gate, and that's a genuinely useful thing to have in an img2img or post-processing pipeline.
How it works
The logic lives in py/EmAySee_ConditionalResize.py. It takes the image's longest side, compares it to trigger_threshold, and branches:
- Longest side ≥ trigger_threshold → return the image unchanged.
- Longest side < trigger_threshold → scale so the longest side becomes
target_resolution, preserving aspect ratio.
The scaling is done with torch.nn.functional.interpolate in one of five modes: nearest-exact, bilinear, area, bicubic, or lanczos. Two source-level quirks worth knowing: lanczos is actually implemented as bicubic (the author's comment says so - they avoided pulling in a proper Lanczos implementation), and nearest-exact is mapped to nearest. So the "lanczos" option isn't real Lanczos.
The inputs that matter
- image - the input frame.
- trigger_threshold (1024) - the minimum longest-side length. Below this, resize happens.
- target_resolution (1024) - what the longest side should become after scaling.
- method - the interpolation mode. For upscaling,
bicubicorareaare the sensible picks;nearestis for pixel-art, andbilinearis a bit soft.
Output is a single IMAGE, either the original or the rescaled version.
Install
Part of the EmAySee pack:
cd ComfyUI/custom_nodes
git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
Restart ComfyUI (or Manager → "ComfyUI_EmAySee_CustomNodes"). Category: EmAySee/Image.
Gotchas
Three things. First, the "lanczos" label is misleading - it's bicubic under the hood, so if you specifically wanted Lanczos quality you're not getting it. Second, both dimensions scale by the same factor, so aspect ratio is preserved but a very tall image gets a big height when you only meant to fix the width - the node has no "only if too small on both axes" mode. Third, the threshold comparison is on the longest side only, so a 900×1500 image at a 1024 threshold does get resized even though one dimension already exceeds 1024. Fine for most cases, but read the logic before assuming. And the pack disclaimer applies: unsupported, no guarantees - but for a resize gate, the math is simple enough to verify at a glance.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| trigger_threshold | INT | 10240–16384 | — |
| target_resolution | INT | 10240–16384 | — |
| method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |