凤希AI - 图片缩放到尺寸
Exact pixels out, and the crop flag that saves your aspect ratio
- images
- IMAGE
Why a resize node is still worth installing
ComfyUI core has ImageScale and ImageScaleBy, and they're fine. What they don't give you is a resize that (a) guarantees an exact width and height across a whole batch, and (b) optionally crops to the target aspect ratio first so the frame doesn't get squashed into a different shape.
FxAiImageScaleDown (凤希AI - 图片缩放到尺寸) is the second one. It's named "scale down" but nothing stops you scaling up - it's a fixed-size resize with a crop mode.
How it works
It loops the batch, converts each frame through PIL, resizes with LANCZOS to exactly width × height, and stacks the results back into one tensor.
The interesting branch is crop. With crop: "center" it computes the aspect mismatch and slices the tensor before resizing, so a 4:3 source going to a 16:9 target loses equal strips off the top and bottom rather than being stretched. The author's tooltip says the same thing in one line: it crops to the target ratio, then scales, and the picture keeps its proportions. With crop: "disabled" it does the dumb, fast thing: resize straight to the target, and whatever your source's aspect ratio was, it isn't any more.
That's a real choice and there's no universal right answer. Stretching is fine when you're normalising a batch of near-identical frames; centring is what you want any time a face is in the shot.
Inputs and outputs
images(IMAGE) - a batch, and the whole batch gets resized to the same target.width(INT, default 512, 1–16384)height(INT, default 512, 1–16384)crop-disabledorcenter
Output: a single IMAGE tensor at exactly width × height.
The batch behaviour is the point in loop workflows: feed it a segment of 120 decoded frames and they all come out the same size, which is a precondition for half the video nodes in this pack.
Where it fits in a real pipeline
Two places, mostly. First, as the guard before anything that demands divisible-by-8 dimensions - you dial the exact numbers you want instead of hoping a scale factor lands on them. Second, as the memory lever: drop the frames before a heavy stage and the whole chain's peak allocation falls with the pixel count. That's exactly the trade the pack's SeedVR2 upscaler assumes you've thought about, since its cost scales with the square of the output size.
If you're doing the "soft source" trick from the broader upscaling playbook - downscale to a fraction of a megapixel first so the restoration model rebuilds from a base that matches the actual sharpness - this node is a straightforward way to hit a target size, with crop: center keeping the composition intact.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit
Restart, or install via ComfyUI Manager by searching fxai-toolkit (registry publisher fxai). The pack auto-installs soundfile and psutil on first import; no model files are involved here.
Where it bites
Alpha gets dropped. The resize path converts each frame with .convert("RGB"), so a four-channel IMAGE comes back as three channels. For video-frame workflows that's a feature (nobody wants a stray alpha in a VAE encode); for compositing work it's a surprise. Do your transparency-sensitive step first, or use a core node that preserves channels.
crop: center crops, it doesn't letterbox. You lose pixels off two edges - up to half the frame on a severe ratio change. If you need the whole original visible, match the target ratio to the source instead.
The target is literal, not snapped. Whatever you type is what you get, 512 or 513 or 1000. Some models - the LTX family, anything with a VAE downsampling by 8 or 16 - want multiples, and this node won't round for you. Type numbers that divide cleanly.
Exact-size resizes don't compose. Two chained instances at 1024 then 512 look worse than one at 512, because you've thrown detail away twice. It's an obvious thing that people still do when a graph has grown.
Node not showing up. The pack imports each node inside its own try/except and prints ❌[凤希AI] 节点加载失败 in the console on failure - one bad module, one missing node, no loud error. Console, then restart.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| width | INT | 5121–16384 | — |
| height | INT | 5121–16384 | — |
| crop | COMBO | disabled | center = 先按目标比例居中裁切再缩放,不改变画面比例。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |