Nodes/ComfyUI-ZML-Image/ZML_双整数V3(判断)
ComfyUI Node

ZML_双整数V3(判断)

Auto-picks the resolution from the aspect of your input image

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_双整数V3(判断)
    • 布尔
    阈值0
    A小于B832,1216
    A等于B1024,1024
    A大于B1216,832

    This is the "judgment" resolution node: you feed it the width and height of something - usually a reference image - and it decides which of three preset resolutions to output based on whether width < height, width ≈ height, or width > height. The author was explicit about why it exists in the changelog: for Wan video-to-video, where you don't want to hand-pick the latent resolution for every input clip and keep forgetting to update it. Feed it the frame dimensions, and it picks the right latent size automatically.

    How it works

    Three string fields hold the candidate resolutions, each as width,height:

    • A小于B (A less than B) - default 832,1216 (portrait).
    • A等于B (A equals B) - default 1024,1024 (square).
    • A大于B (A greater than B) - default 1216,832 (landscape).

    The 宽 and 高 inputs are compared with a 阈值 (threshold, default 0). The logic: if abs(宽 - 高) <= 阈值, you get the equal case; otherwise less-than or greater-than decides. So the threshold lets you treat near-square inputs as square - for a video frame that's 960×976, a threshold of 32 still resolves to 1024×1024 instead of bouncing to a portrait preset over a 16-pixel difference. The boolean output is true in all three paths in the current source, so treat it as "a resolution was selected," not a comparator flag.

    The inputs that matter

    • 宽 / 高 - the reference dimensions. These are forceInput sockets, so you wire them from something like ZML_图像批次到整数 or a size node; you can't just type them in.
    • 阈值 - how close to square before the equal-case fires.
    • The three preset strings - edit these to match whatever model you're targeting.

    Outputs: , (the chosen preset), and 布尔 (boolean).

    Installing

    Same as every node in the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zml-w/ComfyUI-ZML-Image
    

    restart, or ComfyUI Manager. Translation patch at https://github.com/zml-w/ZZZ_ZML_English_Patch. No extra dependencies.

    Common issues

    Two traps. First, the preset fields are plain strings - a typo like 832, 1216 (space after comma) or a single value instead of w,h silently falls back to 1024×1024 via the parser's except path. Keep them exact. Second, this node only judges aspect - it does not care what the target model actually supports, so a model that wants 8-pixel multiples will still get whatever you typed in the presets; the defaults are safe, but if you retarget a different model, update all three presets together or you'll get mismatched behavior. It's a small, opinionated tool built for a specific video workflow, and if that's your workflow it saves you exactly the kind of recurring manual step that eats your day.

    Categoryimage/ZML_图像/整数

    Inputs (6)

    NameTypeDefaultDescription
    INT
    INT
    阈值INT00–16384
    A小于BSTRING832,1216
    A等于BSTRING1024,1024
    A大于BSTRING1216,832

    Outputs (3)

    NameTypeDescription
    INT
    INT
    布尔BOOLEAN