Nodes/ComfyUI-JakeUpgrade/Aspect Ratio JK๐Ÿ‰
ComfyUI Node

Aspect Ratio JK๐Ÿ‰

Never guess the right latent size again โ€” 31 presets for SD15, SDXL, SD3 and Qwen

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
Aspect Ratio JK๐Ÿ‰
    • width
    • height
    โ—„resolutionโ–พโ–บ
    โ—„custom_width512โ–บ
    โ—„custom_height512โ–บ
    โ—„swap_dimensionsfalseโ–บ

    Every diffusion model has resolutions it was trained at, and feeding it something way off that range is how you get doubled heads and cropped compositions. Aspect Ratio JK๐Ÿ‰ is a 31-entry preset menu that hands you a width and height in the native shape of the model you're running - no mental math about what SDXL's base resolution should be.

    It's a small utility, but it's the kind of thing that quietly unblocks beginners. Instead of typing 1152ร—896 from memory every time you build an SDXL workflow, you pick "SDXL 1152x896" from the list and wire the two INT outputs wherever a resolution is expected: Empty Latent Image, Empty SD3 Latent, or the width/height inputs on a KSampler-parameters node.

    How it works

    The mechanism is boring in the best way. A dropdown maps a friendly label to a hardcoded resolution, the node parses "SDXL 1152x896" into two ints, and returns them. The presets are grouped by the model family they belong to - SD15 has a whole band of 512-tall landscape shapes (680, 768, 912, 952, 1024, 1224 wide), SDXL gets its 1024-class portrait/landscape set, SD3 adds a few of its own, and Qwen-image has 1328ร—1328 and friends. The custom path is where it gets more useful than most aspect-ratio nodes: set resolution to "Custom" and the custom_width / custom_height sliders (64โ€“16384, stepping by 8) take over.

    swap_dimensions is the one toggle that will save you an afternoon. Set it true and the node returns height, width - you can keep your landscape preset while composing vertically, or rotate a portrait shot for a social-media crop without changing the preset.

    The inputs that actually matter

    • resolution - the preset list. Start here.
    • custom_width / custom_height - used only when resolution is "Custom".
    • swap_dimensions - flips the output pair.

    Outputs: width and height, both INT. That's it. There's a small guard in the source - if the resolution string somehow fails to parse, it falls back to 512ร—512 rather than crashing the graph, which is a nicer failure mode than a red node.

    Install & gotchas

    Part of the JakeUpgrade pack, so: ComfyUI Manager โ†’ search ComfyUI-JakeUpgrade, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade && pip install -r requirements.txt
    

    No models, no heavy deps beyond the pack's standard list (opencv-python, pillow, torch). One honest note: presets are a convenience, not a rule. SDXL happily generates at non-native sizes when you denoise properly or upscale after; the preset just removes the "which number do I type" step for the common cases. And if the node doesn't show up in your library, check the pack's config.ini - deprecated nodes are hidden by default, though this one isn't among them, so it should just be there.

    Category๐Ÿ‰ JK/๐Ÿ“ฆ Misc

    Inputs (4)

    NameTypeDefaultDescription
    resolutionCOMBOPredefined resolution presets for different models
    custom_widthINT51264โ€“16384Custom width when resolution is set to Custom
    custom_heightINT51264โ€“16384Custom height when resolution is set to Custom
    swap_dimensionsBOOLEANfalseSwap width and height dimensions

    Outputs (2)

    NameTypeDescription
    widthINTโ€”
    heightINTโ€”