Nodes/fxai-toolkit/凤希AI - 宽高-按比例
ComfyUI Node

凤希AI - 宽高-按比例

A ratio calculator that gives you model-friendly sizes, every time

By fxai666·Created 4 months ago·Updated 3 days ago· 35
凤希AI - 宽高-按比例
    • 宽度
    • 高度
    • 对齐基数
    最大边长1300
    宽比例3
    高比例4
    对齐基数32
    尺寸反转false

    FxAiMaxRatioSize (凤希AI - 宽高-按比例) is a plumbing node with one job: turn a width:height ratio into actual pixel dimensions that fit inside a maximum edge, rounded down to a model-friendly multiple. It's the "what resolution do I set my Empty Latent to" problem, automated. You know you want a 3:4 video and you want the longest side around 1300px - but the actual width/height that a video model can digest is a grid multiple, not whatever mental math gives you. This node does the mental math and returns the numbers.

    The math, which you should know even if you never touch the node: scale the ratio so the larger term equals 最大边长, then floor both dimensions down to the nearest multiple of 对齐基数. In code that's w = round(ratio_w * scale) then w = (w // base) * base, same for height. The flooring is the part that keeps a "1300px" request from producing 1296px and confusing you later - you get a clean grid value every time.

    The inputs:

    • 最大边长 - the cap for the longer edge (default 1300).
    • 宽比例 / 高比例 - your aspect ratio, e.g. 3 and 4.
    • 对齐基数 - the grid multiple (default 32; the standard 8/16/32/64 for diffusion latents).
    • 尺寸反转 - swaps width and height on output, for the same ratio in portrait vs. landscape.

    Outputs: 宽度, 高度 (both INT), and 对齐基数 passed through. Feed those two into an Empty Latent or a size config and you've removed the single most common "why does my video come out weirdly cropped" error from your workflow.

    Install is pack-standard and quick: ComfyUI Manager → search "fxai-toolkit", or cd ComfyUI/custom_nodes && git clone https://github.com/fxai666/fxai-toolkit, restart. The pack auto-installs soundfile and psutil on startup; FFmpeg is wanted for audio paths but not needed for this node. One recurring note: every label is Chinese, so you'll see 最大边长, 宽比例, 高比例, 对齐基数 - 凤希AI builds for a Chinese-speaking community (QQ group 775649071, Bilibili).

    Where people get burned: the flooring is down, always. If your ratio is 3:4 and the max edge is 1300, you don't get 1300×1733; you get the largest grid-aligned size that fits under it. And 对齐基数 isn't cosmetic - a video model trained on 64-aligned latents will thank you for 64 even if 32 "also works." It's a two-second node that quietly removes a whole class of "why is the composition cropped" support questions. If you're building a long-video loop, V2 of this node adds the half-width/half-height outputs that multi-crop layouts want - but for a plain ratio you only need this one.

    Category凤希AI/工具

    Inputs (5)

    NameTypeDefaultDescription
    最大边长INT130064–4096
    宽比例INT31–20
    高比例INT41–20
    对齐基数INT322–128
    尺寸反转BOOLEANfalse开启后宽高互换输出

    Outputs (3)

    NameTypeDescription
    宽度INT
    高度INT
    对齐基数INT