凤希AI - 图片缩小 - 按倍数
Downscale an image by an integer factor without breaking downstream nodes
- 图片
- 缩小后图片
- 缩小后高度
- 缩小后宽度
When your 8GB card is sweating, the cheapest lever in the world is resolution. An image at half its size uses a quarter of the VRAM to process, and for reference frames, preview passes, and batch pre-checks that's usually fine. FxAiImageDownscale exists for exactly that: it shrinks an image by an integer factor - 2×, 4×, 10× - in one node, and it's careful about two things that make it painless to drop into an existing graph.
How it works
The math is deliberately simple: new dimensions = old dimensions ÷ 缩小倍数 (an integer from 1 to 100), scaled with Lanczos resampling for quality. Then two safety rules kick in. First, both output dimensions are forced to be even - if the division leaves an odd number, it rounds up by one. Video models and many samplers choke on odd dimensions, so this is the kind of invisible fix that saves you a cryptic error later. Second, dimensions are clamped to a minimum of 2.
The other thoughtful bit is what happens with an empty input. Unlike a lot of nodes, if you feed it None (say, an upstream branch didn't run), it returns (None, 0, 0) instead of raising. Downstream nodes that accept optional inputs just see "nothing here" and move on. That's a genuinely friendly behavior for loop-style workflows where a branch can be inactive on some iterations.
Inputs and outputs
Both inputs are optional. 图片 is the IMAGE to shrink; 缩小倍数 defaults to 2 (1–100). You get three outputs: 缩小后图片, 缩小后高度, and 缩小后宽度 - the dimensions as separate INTs, which is handy if something downstream needs to know the resolution it's about to process.
Installing it
Part of fxai-toolkit (凤希AI, MIT). Install once via ComfyUI Manager (search "fxai-toolkit") or:
cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit
# restart ComfyUI
No models, no dependencies beyond the pack's first-load auto-install of soundfile and psutil. Chinese labels; support through the author's QQ group (775649071) and Bilibili.
Where people get burned
The "integer factor" part is the constraint. You can't ask for a specific target size like 768 - only a divisor of the current size. Want a specific resolution? The pack's other size node (FxAiImageSizeConfig, which works on the longest edge) is the one for that; this node is strictly "divide by N." Also, that even-dimension rounding means the output isn't a mathematically exact w/N × h/N - it's that value nudged up to evenness, which is fine for almost everything but worth knowing if you're doing pixel-precise work. And it's worth repeating: at 100× you're basically making a thumbnail, so the 1–100 range is generous, not a promise.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| 图片opt | IMAGE | — | |
| 缩小倍数opt | INT | 21–100 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 缩小后图片 | IMAGE | — |
| 缩小后高度 | INT | — |
| 缩小后宽度 | INT | — |