DaSiWa Torch Resize
A sharper, dependency-free resize for images and video
- image
- image
Most "better resize" nodes in the ComfyUI ecosystem pull in Pillow, a separate resampling library, or a vendor SDK. This one doesn't - it's built entirely on the PyTorch ops ComfyUI already has loaded, and it still beats the built-in bilinear/bicubic resize on sharpness. If you've been reaching for a heavier upscale node just to get a cleaner downscale, this is worth trying first.
Why it's sharper
Two things do the actual work: Lanczos resampling instead of bilinear/bicubic, and optional gamma correction. Lanczos is a wider-kernel filter that preserves more high-frequency detail than the interpolation methods ComfyUI's native resize uses by default - the visible difference shows up most on downscales, where naive resizing muddies fine texture. Gamma correction (gamma_correct, on by default) converts to linear light before resampling and back to sRGB after, which avoids the slightly-too-dark, slightly-muddy midtones you get resizing directly in sRGB space - a subtle effect on any single image, but a real one if you're doing repeated resize passes in a pipeline.
How it works
size_mode picks how you specify the target: Multiplier (scale by a factor, via scale_multiplier) or Target resolution (exact target_width/target_height). aspect_mode decides what happens when the source and target aspect ratios don't match: Stretch (distort to fit exactly), Fit (scale to fit inside the target, may not fill it), Fill and crop, Fit and pad (with pad_color and crop_position controlling the details), or Long side with divisible crop.
For video batches specifically, the node auto-chunks: max_batch_megapixels caps how much it processes in one go and batch_size lets you force a specific chunk size, so a long frame sequence gets split into memory-safe pieces automatically instead of you manually splitting the batch upstream. Output order is preserved across chunks. cache_size controls how many Lanczos kernels it keeps cached - matters for speed when you're resizing many frames at slightly different sizes in one run, less so for a single still image.
divisible_by snaps the final output to a multiple of your chosen number, the same kind of grid constraint you'd need feeding into a video model's VAE. interpolation lets you drop down to Nearest/Bilinear/Bicubic/Area if you specifically want those instead of Lanczos - Nearest for pixel-art-style work where you don't want any blending at all, Area when you're doing a large downscale and want the classic "average the pixels" behavior.
The inputs and outputs that matter
imagein,imageout - single port each way, this is a straight transform node.size_mode+ (scale_multiplier, default 2) or (target_width/target_height, default 1920×1080) depending on the mode.aspect_mode- pick based on whether you can tolerate distortion, cropping, or padding for your specific use case.gamma_correct- leave it on unless you have a specific reason to match legacy non-gamma-aware resize output.
How to install it
ComfyUI Manager - search DaSiWa-Nodes, install, restart. Manual: clone into custom_nodes, pip install -r requirements.txt, restart. Genuinely zero extra dependencies for this specific node - it's the one in the pack you can install with the least risk of a version conflict.
Common issues & troubleshooting
Colors look slightly different from ComfyUI's native resize on the same image. That's gamma_correct doing its job - the difference is intentional and is generally the more correct result, but if you need bit-for-bit parity with a non-gamma-aware pipeline, turn it off.
Alpha channel edges look off after resize. Shouldn't happen - transparency is resized independently of the gamma conversion specifically to avoid this. If you're seeing artifacts on alpha, check whether the source actually has a real alpha channel or a flattened one masquerading as RGBA.
Long video batch runs out of memory anyway. Lower max_batch_megapixels - the auto-chunking caps per-chunk size, but if the cap itself is set too high for your VRAM, you're back to the same problem one level up. Bring it down until it fits, rather than fighting it with batch_size alone.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| size_mode | COMBO | Multiplier | 2 options: Multiplier, Target resolution |
| aspect_mode | COMBO | Fit | 5 options: Stretch, Fit, Fill and crop, Fit and pad, Long side with divisible crop |
| target_width | INT | 19201–16384 | — |
| target_height | INT | 10801–16384 | — |
| scale_multiplier | FLOAT | 2.000.01–16 | — |
| interpolation | COMBO | Lanczos | 5 options: Nearest, Bilinear, Bicubic, Area, Lanczos |
| gamma_correct | BOOLEAN | true | — |
| divisible_by | INT | 11–4096 | — |
| pad_color | STRING | 0, 0, 0 | — |
| crop_position | COMBO | center | 9 options: center, top-left, top, top-right, left, right, +3 |
| batch_size | INT | 00–4096 | — |
| max_batch_megapixels | FLOAT | 16.000.25–512 | — |
| cache_size | INT | 641–512 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |