Resize Image v2 (KJ Alternative)
The resize node that finally settles crop-vs-pad-vs-blur
- image
- mask
- IMAGE
- width
- height
- mask
Every video workflow ends in the same argument. Your model wants 1344×768, your source image is 3:2, and you have to decide whether to crop the photo, stretch it, or letterbox it - and you'd rather make that call in one node than three. That's what Resize Image v2 (KJ Alternative) is for.
It's a direct port of kijai's resize node from KJNodes, re-registered under its own class name so it can sit in the same graph as KJNodes without a name collision. Same behavior, no fighting. The one thing that's genuinely new here is an optional NVIDIA RTX VSR upscale path, which gets a paragraph of its own below.
What it actually does
Feed it an IMAGE, give it a target width and height, and it resizes. The keep_proportion dropdown is where the real work happens - it's not a checkbox, it's a menu of eight strategies. Most days you only care about three of them:
stretch- force it into the box, ignore the aspect ratio. Distortion, but predictable.crop- scale to fit, then crop the overhang. Pair it withcrop_position(center/top/bottom/left/right) so you keep the part of the frame you actually care about.padandpillarbox_blur- fit the whole image and fill the leftover space with a solidpad_color(default"0, 0, 0") or a blurred copy of the image itself. The blur one is what makes a video look intentional instead of banded.
resize and total_pixels are the oddballs: resize keeps the aspect ratio by the highest dimension, and total_pixels targets a pixel budget rather than exact dimensions. Niche, but they're why people port this node into their own packs.
The inputs that matter
upscale_method- nearest-exact, bilinear, area, bicubic, lanczos, andnvidia_rtx_vsr. For real resizing, lanczos or bicubic are the honest picks; the others exist so you can match how something was produced.width/height(defaults 512, up to 16384) - the target box.divisible_by(default 2) - this is the one that saves you an evening of "latent dimension not divisible" errors. Set it to 16 or 32 for most video models.- Optional
maskinput and adevicetoggle (cpu/gpu) for when you're batching on a card that's already full.
Outputs: the resized IMAGE, the actual output width and height as INTs (handy to wire forward into other nodes), and the resized mask.
The RTX VSR option
nvidia_rtx_vsr uses NVIDIA's video super-resolution path, lazily loading the optional nvvfx / nvidia-vfx runtime on compatible CUDA NVIDIA GPUs and snapping output to the nearest multiple of 8. It sits on the "more pixels, want it now" rung of the upscaling ladder - closer to a very good Lanczos than to a generative restorer, and the community reads its output as more natural than diffusion upscalers on already-clean sources. It will not add eyelashes, so don't reach for it to repair a genuinely soft image. That's a different job and a different node.
Install & gotchas
ComfyUI Manager, search "ComfyUI_Swwan", or:
cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
pip install -r ComfyUI_Swwan/requirements.txt
then restart ComfyUI. The pack's requirements are light - torch, numpy, opencv, scipy, spandrel, color-matcher - nothing model-download sized. The VSR path is the only heavyweight, and it's optional. If nvidia-vfx refuses to build from requirements, the known fix is:
python -m pip install -U --no-build-isolation nvidia-vfx --index-url https://pypi.nvidia.com
And one reminder: the VSR path aligns output to multiples of 8. Set divisible_by to match instead of fighting it, and the whole thing behaves.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 5120–16384 | — |
| height | INT | 5120–16384 | — |
| upscale_method | COMBO | 6 options: nearest-exact, bilinear, area, bicubic, lanczos, nvidia_rtx_vsr | |
| keep_proportion | COMBO | false | 8 options: stretch, resize, pad, pad_edge, pad_edge_pixel, crop, +2 |
| pad_color | STRING | 0, 0, 0 | Color to use for padding. |
| crop_position | COMBO | center | 5 options: center, top, bottom, left, right |
| divisible_by | INT | 20–512 | — |
| maskopt | MASK | — | |
| deviceopt | COMBO | 2 options: cpu, gpu |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |