Nodes/ComfyUI-SD3LatentSelectRes/SD3/Flux Select Latent Resolution V2
ComfyUI Node

SD3/Flux Select Latent Resolution V2

The SD3/Flux resolution node that does the math

By GavChap·Created 2 years ago·Updated 7 months ago· 15
SD3/Flux Select Latent Resolution V2
    • width
    • height
    • samples
    aspect_ratio1:1
    megapixels1
    latent_typeSD3
    batch_size1

    The original SD3LatentSelectRes gives you a curated list of 43 resolutions. SD3LatentSelectResV2 asks a different question: what if you want 21:9 at 3.5 megapixels and don't want to go hunting for a preset? It takes any of 13 aspect ratios, any megapixel target, and computes the exact width and height for you - rounded to a multiple of 16 so the latent stays valid. Think of it as the arbitrary-ratio version of the same idea, with one genuinely new knob: a latent-type switch that also covers Flux2.

    That Flux2 bit is the reason this node exists rather than just being a calculator. FLUX.2 retrained its VAE from scratch - it's 128 channels with 16x compression per side, not the 16-channel, 8x layout that SD3, Flux 1, Z-Image, Qwen-Image, and Wan all share. The old 16-channel empty latent is useless for it, and ComfyUI's default empty-latent node doesn't know either way. This one does.

    How it works

    The math is straightforward: it parses your ratio, works out height from height = sqrt(area / ratio) where area is your megapixel figure times 1,048,576 (the node's "megapixel" is really units of 1024x1024), derives width from the ratio, and rounds both to the nearest 16. Then it builds the latent:

    • latent_type = "SD3/Flux/Z-Image/Qwen/etc": 16 channels, height/8 by width/8
    • latent_type = "Flux2": 128 channels, height/16 by width/16

    Both fill with 0.0609, the mean of these latent spaces - the same initialization ComfyUI's SD3/Flux empty-latent nodes use, and the right call for every model in the list.

    The inputs that matter

    • aspect_ratio - 13 options: 1:1, 16:9, 9:16, 4:3, 3:4, 4:5, 5:4, 3:2, 2:3, 21:9, 9:21, 2:1, 1:2. Default 1:1.
    • megapixels - 1.0 to 8.0 in 0.5 steps. This is the size knob, and where the "it's a calculator" framing earns its keep.
    • latent_type - the one that matters, described above. Defaults to the 16-channel group.
    • batch_size - 1 to 4096, leave it at 1 unless you're batching.

    Outputs are the same triple as V1: width and height as INT, and samples, the LATENT that goes into your KSampler.

    Where people get burned

    The latent_type switch is a footgun, not a convenience. Pick "Flux2" while running a Flux 1 or SD3 model and the sampler receives a 128-channel tensor it doesn't understand - expect nonsense or an out-of-memory error, not a graceful warning. Pick the 16-channel option for an actual Flux2 model and you get the mirror-image failure. It defaults to the 16-channel group, so you only trip it by choosing to; just make the choice deliberately.

    Also worth knowing: unlike V1, whose presets are all known-trained ratios, V2 will happily compute something like 6.5MP at 21:9. Most current models stay coherent in the 1–2MP band and degrade softly past it, so "can compute" and "should generate at" are different things. For everyday Flux work the fixed presets in V1 are arguably the safer pick; V2 shines when you need a ratio or size the list doesn't offer, or when you're on Flux2.

    Installing it

    No dependencies, no model downloads. Both nodes ship in the same pack, so this installs alongside V1.

    cd ComfyUI/custom_nodes
    git clone https://github.com/GavChap/ComfyUI-SD3LatentSelectRes
    

    Restart ComfyUI and it shows up under generate/sd3 as "SD3/Flux Select Latent Resolution V2." ComfyUI Manager users can search "SD3 Latent Select Resolution" instead. One restart, both nodes, and a resolution picker that finally does the division for you.

    Categorygenerate/sd3

    Inputs (4)

    NameTypeDefaultDescription
    aspect_ratioCOMBO1:113 options: 1:1, 16:9, 9:16, 4:3, 3:4, 4:5, +7
    megapixelsCOMBO115 options: 1, 1.5, 2, 2.5, 3, 3.5, +9
    latent_typeCOMBOSD32 options: SD3/Flux/Z-Image/Qwen/etc, Flux2
    batch_sizeINT11–4096

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    samplesLATENT