ComfyUI Node

OutputLongLength01

One INT out, and it's always the long edge

By mittimi·Created 2 years ago·Updated 6 months ago· 3
OutputLongLength01
    • INT
    Width512
    Height512

    OutputLongLength01 is the entire pack's ethos in one node: you feed it two numbers and it hands back the bigger one. That's it. Three lines of Python, no dependencies, no config. It comes from mittimi's ComfyUI_mittimiWidthHeight pack, and like its siblings it exists because the author found it faster to write than to hunt down a node that already did it. For once, that's actually a defensible move - there isn't a great built-in for this, and it's so small there's nothing to break.

    What it's actually for

    The real use case is orientation-agnostic sizing. If your workflow sometimes gets a portrait image (768×512... no, 512 wide × 768 tall) and sometimes a landscape one, and some downstream node cares about the long edge rather than a specific dimension, this is your adapter. Feed it whatever width and height you have and it outputs the larger of the two, so you don't have to hand-pick the number every time you flip orientation.

    Concrete spot: an upscaler or detailer pass that wants to target a maximum long side, or a resize node that works on the longest dimension. Wire this node's INT output into the "size" or "long side" input and it follows your width/height changes automatically. If your resolution inputs are already just constants, honestly, you don't need it - but the moment you're routing dims around a graph, it earns its place.

    How it works

    The logic is about as grounded as it gets. Read the source and it's exactly what you'd write:

    longlength = Width
    if (Height > Width):
        longlength = Height
    

    Two INT inputs, one INT output. It can't fail, because it can't do anything else. There's no rounding, no aspect-ratio math, no batch handling - a tie returns Width, and that's the whole decision tree.

    The inputs and outputs

    • Width (INT, default 512) and Height (INT, default 512) - the two dimensions you're comparing.
    • Output is a single INT named, honestly, just "INT" - that's the author's own naming, not a typo on our side. If you see a wire labeled INT coming out of it, that's the long edge.

    Wire it into any input that wants a single integer dimension. That's the entire API.

    Install

    This is the easiest pack install you'll ever do. No requirements.txt, no model downloads, nothing to pip. Use ComfyUI Manager and search mittimi or ComfyUI_mittimiWidthHeight, or clone it yourself:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mittimi/ComfyUI_mittimiWidthHeight
    

    Restart ComfyUI and you'll find all three nodes under mittimiTools.

    Gotchas

    • The output name is "INT" - confusing on first glance, harmless once you know.
    • It only handles Height > Width; equal dimensions return Width, which is the same number anyway.
    • There's no min/max clamp on the output; it passes through whatever the inputs were, so upstream validation is your responsibility.

    Is this a node you'd seek out? Probably not on its own. But if you've already got the pack installed for the Swap button, this one quietly solves the "long side" question for free.

    CategorymittimiTools

    Inputs (2)

    NameTypeDefaultDescription
    WidthINT5121–2147483647
    HeightINT5121–2147483647

    Outputs (1)

    NameTypeDescription
    INTINT