Nodes/ComfyUI-JakeUpgrade/SDXL Target Res JK๐Ÿ‰
ComfyUI Node

SDXL Target Res JK๐Ÿ‰

SDXL resolution math you were doing in your head, in one node

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
SDXL Target Res JK๐Ÿ‰
    • target_width
    • target_height
    โ—„width1024โ–บ
    โ—„height1024โ–บ
    โ—„target_res_scale1.00โ–บ

    SDXL has a native resolution around 1024ร—1024, and the fastest way to wreck a generation is to feed it something like 1112ร—904. The model doesn't really "understand" pixels - its VAE encodes in 8ร—8 blocks, so anything that isn't a clean multiple of 8 gets silently nudged, and the SDXL text encoder's target resolution is notoriously picky about the same thing. JakeUpgrade added this node in v1.8.0 for exactly that reason: to stop hand-calculated resolutions from coming out wrong.

    What it does is dead simple. You give it the width and height you actually want, plus a scale factor, and it returns two clean integers that are guaranteed multiples of 8.

    The inputs that matter

    • width (1024) and height (1024) - your starting resolution.
    • target_res_scale (1.0) - a multiplier. Set it to 1.5 and a 1024ร—1024 request becomes a 1536ร—1536 target. This is the field you'd drive from a resize-ratio node or a "scaled up by X" parameter elsewhere in the graph.

    That's the whole node. Three inputs, and the math is round_up_to_multiple_of_8(width * scale) on both axes.

    Where the outputs go

    The two outputs are target_width and target_height (both INT). Wire them into an Empty Latent Image for the size you actually sample at, or into the SDXL clip text encoder's target-resolution fields if you're using the built-in dual-CLIP encode. The point is to make the latent size and the text encoder's idea of the size agree, which is what keeps composition sane on non-square outputs.

    Installing it

    It's part of the JakeUpgrade pack, so you install it once and get this node plus a couple hundred others:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    # Windows standalone: run install.bat
    pip install -r requirements.txt
    

    Or just search "JakeUpgrade" in ComfyUI Manager and let it handle everything. Restart ComfyUI either way. None of these eight nodes need model downloads - the pack's requirements are OpenCV, Pillow, numpy, PyYAML and friends.

    Gotchas

    Two things trip people up. First, if the node doesn't show up in your node list, it's probably the pack's deprecation gating: the config file (config.ini in the pack folder) has LOAD_DEPRECATED_NODES = False and ENABLED_MODULES = all. SDXL Target Res was briefly flagged deprecated, then moved back to the main Misc section - but if your copy predates that, flip the config or update the pack. Second, the pack's README carries a standing warning: the ComfyUI MultiGPU extension causes CUDA errors on recent ComfyUI and should be disabled. Neither has anything to do with this node doing math, but both will make you think the pack is broken.

    It's a boring utility node, and that's the compliment. One node, three fields, no surprises, and your latent sizes stop lying to you.

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

    Inputs (3)

    NameTypeDefaultDescription
    widthINT1024Original width to scale from
    heightINT1024Original height to scale from
    target_res_scaleFLOAT1.000.01โ€“16Scale factor for target resolution

    Outputs (2)

    NameTypeDescription
    target_widthINTโ€”
    target_heightINTโ€”