Nodes/ComfyUI_JosiaNodes/Josia图像缩放
ComfyUI Node

Josia图像缩放

Every resize mode you've ever wanted, in one Chinese-labeled panel

By Josia-doit·Created 6 months ago·Updated a day ago· 16
Josia图像缩放
  • 图像
  • 遮罩
  • 图像
  • 遮罩
  • 宽度
  • 高度
选择比例
锁定倍数16
裁剪方式中心裁剪
缩放算法area
📏 启用边长缩放false
缩放至边最长边
缩放长度1024
🖼️ 启用像素缩放false
像素数量(百万)1.00
分辨率步数1
✏️ 启用手动宽高false
🔄 切换宽高false
宽度1024
高度1024

JosiaImageScaling (Josia图像缩放) is a do-everything resize and crop node. Aspect-ratio presets, edge-based scaling, megapixel-target scaling, manual width/height, multiple-of alignment, five interpolation algorithms, six crop modes - it's a Swiss Army knife for the most common image-prep task in ComfyUI, which is "make this image a specific size that the model actually wants."

The three ways to scale

You pick one scaling strategy and the node does the rest:

  • 按像素缩放 (megapixel scaling) - tell it a target in megapixels and it computes dimensions from the image's own aspect ratio. Capped at 4 megapixels, which the README flags as deliberate resolution protection so you don't blow your VRAM by asking for 20MP.
  • 边长缩放 (edge scaling) - scale so the longest or shortest edge hits a target pixel value, other side follows proportionally.
  • 手动宽高 (manual W/H) - just type width and height, with a one-click 切换宽高 (swap dimensions) button.

On top of that sit the four preset drop-downs (1:1 square, 2:3/3:2, 3:4/4:3, 16:9/9:16), each offering a ladder of common sizes in both orientations. Pick a preset and you don't touch the math at all.

The settings that actually change your results

  • 锁定倍数 (multiple-of lock, default 8) - snaps dimensions to a multiple of 8/16/32/etc. This matters more than beginners think: VAE encode/decode and most attention layers want sizes divisible by 8, and off-by-a-few-pixel dimensions cause silent quality loss or errors.
  • 缩放算法 (interpolation, default area) - the usual ladder: nearest, bilinear, area, bicubic, lanczos. area is a sensible downscaling default; switch to lanczos when you're upscaling and want to keep edges crisp.
  • 裁剪方式 (crop mode, default center) - center, top/bottom/left/right aligned, or stretch-to-fill. This is where you control what gets cut when the source ratio doesn't match the target.
  • 分辨率步数 (resolution steps) - progressive multi-step scaling for big downscales; more steps means less aliasing but slower.

Inputs and outputs

Optional 图像 (image) and 遮罩 (mask) inputs, and four outputs: 图像 (the resized IMAGE), 遮罩 (the resized MASK), and 宽度/高度 as INTs. The width/height outputs are the sleeper feature: feed no image at all and the node still hands you clean dimensions, which you can wire into an Empty Latent for a text-to-image workflow that inherits your chosen ratio. Leave every dimension setting at "off" and the image passes through untouched - it's a polite node.

Install

Part of ComfyUI_JosiaNodes, zero extra Python dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/Josia-doit/ComfyUI_JosiaNodes

or via ComfyUI Manager (search ComfyUI_JosiaNodes), then restart. Find it under Josia.

Where people get burned

The UI is entirely in Chinese - every preset and mode label reads like 16:9全平台视频, and there are fourteen boolean/enum settings stacked on the node. That's the honest downside: enormous capability, busy panel. The README is thorough but in Chinese, so keep a translation open for the first session. And remember the 4-megapixel cap: if your 8MP image comes back at 4MP, that's not a bug, that's the VRAM guard doing its job.

Category⚡️JosiaNodes

Inputs (16)

NameTypeDefaultDescription
选择比例COMBO10 options: 关, 1:1 正方形, 2:3 竖屏, 3:2 横屏, 3:4 竖屏, 4:3 横屏, +4
锁定倍数COMBO168 options: 关, 2, 4, 8, 16, 32, +2
裁剪方式COMBO中心裁剪6 options: 中心裁剪, 对齐上边, 对齐下边, 对齐左边, 对齐右边, 拉伸缩放
缩放算法COMBOarea5 options: nearest-exact, bilinear, area, bicubic, lanczos
📏 启用边长缩放BOOLEANfalse
缩放至边COMBO最长边2 options: 最长边, 最短边
缩放长度INT102432–4096
🖼️ 启用像素缩放BOOLEANfalse
像素数量(百万)FLOAT1.000.01–4
分辨率步数INT11–3
✏️ 启用手动宽高BOOLEANfalse
🔄 切换宽高BOOLEANfalse
宽度INT102432–4096
高度INT102432–4096
图像optIMAGE
遮罩optMASK

Outputs (4)

NameTypeDescription
图像IMAGE
遮罩MASK
宽度INT
高度INT