Nodes/SDXL_sizing/sizing for SDXL (advanced)
ComfyUI Node

sizing for SDXL (advanced)

Why your crops look wrong

By Ser-Hilary·Created 3 years ago·Updated 2 years ago· 28
sizing for SDXL (advanced)
    • width
    • height
    • crop_w
    • crop_h
    • target_width
    • target_height
    • downscale
    native_res1024
    aspect1:1
    original_res800x1200
    crop_extra0.000
    downscale_effect0.000
    verbose
    fit_aspect_to_bucket
    strict_bucketing
    extra_args

    sizing_node ("sizing for SDXL (advanced)") is the big sibling in the Ser-Hilary/SDXL_sizing pack: everything the basic node does, plus the knobs you reach for when you actually care which bucket you land in, want to see the math, or want to experiment with SDXL's crop conditioning. If you're here because you keep getting images cropped oddly at non-standard sizes, this is the node that tells you exactly why - and lets you do something about it.

    How it works

    Same engine as sizing_node_basic - the basic node literally subclasses it. It picks the nearest SDXL training bucket for your aspect ratio, computes the six conditioning values (width, height, crop_w, crop_h, target_width, target_height) that describe the hypothetical "original" image and its crop, and hands you the generation size and an optional downscale factor. What the advanced version adds is control over which bucket list is "nearest."

    The three string inputs parse the same way they do on the basic node: native_res stays 1024, aspect accepts 1:1, 16:9, 0.5, -1 (inherit from original), and original_res takes a bare long-side number, an exact WxH, or a float like 2.0 to scale the gen size.

    The knobs that matter

    • strict_bucketing - the interesting one. Four modes: SDXL Report (the full bucket list from the SDXL paper, the default), Comfy (the nine buckets the ComfyUI dev explicitly recommends - fewer, but "these had the most training data and produce the best results," per the source), Smallest Buckets (a handful of low-pixel buckets, handy for VRAM-strapped machines), and disabled (theoretical 64-multiple bucketing instead of a fixed list). Beyond ~4:1 aspect there's no real training bucket, and the node quietly disables strict bucketing for those.
    • verbose - basic prints the seven outputs to the console; full walks you through the scaling and crop math step by step. Turn it on once. It's the best documentation of how SDXL sizing actually works that this pack has, and it'll show you where your crops are coming from.
    • fit_aspect_to_bucket - after picking a bucket, it adjusts the effective aspect to match it so crop_w/crop_h come out at or near zero. It's the "I don't want any cropping at all" cheat.
    • downscale_effect - 0 means the downscale output does nothing; 1 means it scales your generation back to match the original resolution (minus crop). The author built this for his own downscaling habit and admits most people don't want it.
    • crop_extra - extra crop as a fraction of gen size. Kept low, or zero, per the author's own warning that it tends to look odd.

    The extra_args toy box

    The extra_args string at the bottom is where this node gets genuinely weird, and the author is upfront that some of it is experimental. A few that are actually useful:

    • --nocrop - forces crop_w/crop_h to 0 for A/B testing whether plausible crops even matter.
    • --randomaspect 2x3 4x2 - random aspect between two bounds (defaults 0.25 to 4.0). Note it's random per workflow run, not per generation - the author says he'd need to make ComfyUI call the node per batch for that.
    • --sharp / --extrasharp / --supersharp - scale the width/height conditioning by 133% / 167% / 200% while keeping the gen size. That's the img2img trick: feed it a small input image's dimensions but generate with larger conditioning values.
    • --nudge w 0.8 - produces an original resolution with 80% of the maximum plausible width-cropping, for stress-testing at the edges of crop_w.
    • --shortside and --equivalent - change how a bare number in original_res is interpreted (long side vs. short side vs. matching pixel area).

    Install and gotchas

    Same as the rest of the pack: ComfyUI Manager → search SDXL_sizing, or git clone https://github.com/Ser-Hilary/SDXL_sizing into ComfyUI/custom_nodes and restart. Zero dependencies, zero model files, pure arithmetic.

    The trap with this node is over-configuring it. If the basic node covers your use, use it - strict_bucketing on SDXL Report is a perfectly good default and extra_args is a sandbox, not a requirement. Where the advanced node genuinely earns its keep: debugging crop behavior with verbose = full, forcing no-crop generations with fit_aspect_to_bucket, and the --sharp family for img2img. Everything else is toys you'll try once and leave alone.

    Categorysizing

    Inputs (9)

    NameTypeDefaultDescription
    native_resSTRING1024
    aspectSTRING1:1
    original_resSTRING800x1200
    crop_extraFLOAT0.0000–1
    downscale_effectFLOAT0.0000–1
    verboseoptCOMBO3 options: disabled, basic, full
    fit_aspect_to_bucketoptCOMBO2 options: disabled, enabled
    strict_bucketingoptCOMBO4 options: SDXL Report, Comfy, Smallest Buckets, disabled
    extra_argsoptSTRING

    Outputs (7)

    NameTypeDescription
    widthINT
    heightINT
    crop_wINT
    crop_hINT
    target_widthINT
    target_heightINT
    downscaleFLOAT