图南智能缩放
The resize node that respects the rule of 64
- 图像
- 图像
- 宽
- 高
This is the node in the 图南画桥 (TuNan Paint Bridge) pack that has nothing to do with Photoshop. TuNanSmartResize is a plain, boring, genuinely useful resize utility: it scales an image so one edge lands at a target length, then snaps both dimensions to a multiple of 64. That second part is the whole point. ComfyUI's latent space is happiest with dimensions divisible by 64, and eyeballing an image-size node until the number is clean is a chore this node just does for you.
How it works
You tell it a 目标边长 (target edge length, default 1024) and which edge that applies to via 按哪条边 - 长边 (long edge) or 短边 (short edge). It scales proportionally from there, then snaps each dimension to the nearest multiple of 尺寸对齐 (default 64, settable 8–128). The output is a clean, latent-friendly size you can feed straight into a VAE encode.
Three decisions actually matter:
- 缩放限制 stops it from doing damage: 自由缩放 just obeys, 仅放大 won't downscale (useful when a small input should stay small), 仅缩小 won't upscale (great for "this photo is 4000px, make it 1024 - never the reverse").
- 缩放质量 is the interpolation: 最快 = nearest, 平滑 = bilinear, 高清 = bicubic (the default, with antialiasing), 保面积 = area. Use 保面积 when you're aggressively shrinking, like a 4000px photo down to 1024 - area mode is the one that doesn't turn fine detail into shimmering moiré. Nearest is for pixel-art and nothing else.
- The 宽 and 高 outputs are the post-alignment numbers, which is what matters. Trust them, not your own arithmetic, because the snapping can shift the final size a few pixels off what you mentally calculated.
Why you'd reach for it
Two jobs. First, normalizing arbitrary inputs - a scanned photo, a PNG that's 1530×2150, a screenshot - down to latent-friendly dimensions before a hi-res or img2img pass. It slots in right before VAEEncode and you never think about it again. Second, in the pack's own Photoshop loop, where the document PS sends over can be any resolution and needs to be tamed into something the sampler can chew. But honestly, even if you never install the .ccx Photoshop plugin, this node is worth having for the first job alone.
Getting it installed
Via ComfyUI Manager (search tunan-paint-bridge-nodes or 图南画桥), or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/beiyue0208ly/tunan-paint-bridge-nodes
cd tunan-paint-bridge-nodes
pip install -r requirements.txt
Restart ComfyUI. Dependencies are aiohttp, numpy, Pillow, scipy - nothing heavy, no model downloads. This node runs standalone, so you can install the pack purely for the utilities and skip the Photoshop plugin entirely.
When it surprises you
The main gotcha: 仅缩小 is a no-op on images already smaller than the target - it refuses to upscale, so you get the same image back and wonder if the node broke. It didn't; that's the policy working. And if you're downscaling hard, don't default to 高清 (bicubic) out of habit - that's when 保面积 earns its keep. One more: alignment snaps to the nearest multiple, so an image that "should" be 1024 wide can come back 960, 1024, or 1088 depending on where the aspect math landed. That's fine. The 宽/高 outputs exist precisely so you know what you actually got.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| 图像 | IMAGE | — | |
| 目标边长 | INT | 102464–16384 | — |
| 按哪条边 | COMBO | 长边 | 2 options: 长边, 短边 |
| 缩放限制 | COMBO | 自由缩放 | 3 options: 自由缩放, 仅放大, 仅缩小 |
| 尺寸对齐 | INT | 648–128 | — |
| 缩放质量 | COMBO | 高清 | 4 options: 最快, 平滑, 高清, 保面积 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 图像 | IMAGE | — |
| 宽 | INT | — |
| 高 | INT | — |