Nodes/comfyui-AGSoft/AGSoft Empty Latent Flux.2
ComfyUI Node

AGSoft Empty Latent Flux.2

FLUX.2 latents without doing the ÷16 in your head

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
AGSoft Empty Latent Flux.2
    • latent
    • width_px
    • height_px
    • width_latent
    • height_latent
    size_mode
    presetSquare - 1024x1024 (1:1)
    width1024
    height1024
    megapixels1.0
    aspect_ratio
    divisibility64
    batch_size1

    FLUX.2 latents don't follow the SD rules, and that trips everyone up once. With SD/SDXL, the latent is 1/8 of the image on each side. FLUX.2's VAE is twice as aggressive: the latent is 1/16 - a 1024×1024 image becomes a 64×64 latent, not 128×128. Feed it an SD-sized latent and you'll get garbage or a crash, whichever comes first. AGSoft Empty Latent Flux2 exists so you never think about the ÷16 yourself.

    This is the Flux-flavored sibling of the pack's generic AGSoft Empty Latent: same structure, FLUX.2's geometry baked in. If you run Flux 2 models in this era of ComfyUI, you'll probably want both in your graph at some point.

    How it works

    Same three size_mode choices as the base node - Preset, Custom, Megapixels - but the latent it emits divides by 16 and enforces the constraints FLUX.2 needs. In Custom mode the minimum width/height is 16 (because the latent would otherwise be 1 pixel or less), and dimensions step in multiples of 8. Megapixels mode combines megapixels with an aspect_ratio (1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 21:9, 9:21) and rounds to the chosen divisibility - 64 by default, and the dropdown also offers 112 if you're ever sharing a workflow with QwenImage nodes.

    Outputs are the useful quartet: latent (the tensor), width_px/height_px (image resolution), and width_latent/height_latent (the much smaller latent size - the numbers that look "wrong" if you're used to SD, and the reason this node exists). batch_size covers multi-image generation.

    The inputs in practice

    For 95% of use you'll set size_mode to Preset and grab a named resolution, or leave it on Megapixels at 1.0 and pick an aspect ratio - which is the friendliest path, since you never have to know whether 1344×768 is a supported Flux size. divisibility only matters when you're mixing this node into a pipeline whose other stages have their own constraints.

    Installing it

    Same as every node in the pack: ComfyUI Manager → search comfyui-AGSoft → install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
    

    No downloads, no model files, no dependencies beyond PyTorch. It's a tiny node in a self-contained pack.

    Common issues

    The realistic failure mode is model confusion, not node failure: if you use this latent with an SDXL checkpoint, or the base Empty Latent with FLUX.2, the channel/layout mismatch will produce broken images - and the error message may not say why. The pack deliberately ships separate latent nodes per architecture, so the rule is simple: match the node to the model. If a shared Flux 2 workflow keeps failing at the sampler with a "divisible by" error, check whether someone replaced this node with the generic one along the way - it's a subtle break that looks like a model problem.

    CategoryAGSoft/nodes

    Inputs (8)

    NameTypeDefaultDescription
    size_modeCOMBOChoose how to define the image size: - Preset: Use predefined sizes (Square/Portrait/Landscape) - Custom: Manually enter width and height - Megapixels: Specify target resolution in megapixels Выберите способ задания размера изображения: - Preset: Использовать предустановленные размеры - Custom: Вручную указать ширину и высоту - Megapixels: Задать разрешение в мегапикселях
    presetCOMBOSquare - 1024x1024 (1:1)Select a predefined resolution and aspect ratio. Выберите предустановленное разрешение и соотношение сторон.
    widthINT102416–4096Width in pixels (must be divisible by 16 for FLUX.2). Ширина в пикселях (должна быть кратна 16 для FLUX.2).
    heightINT102416–4096Height in pixels (must be divisible by 16 for FLUX.2). Высота в пикселях (должна быть кратна 16 для FLUX.2).
    megapixelsFLOAT1.00.1–10Target resolution in megapixels (e.g., 1.0 = 1,000,000 pixels). Целевое разрешение в мегапикселях (например, 1.0 = 1 000 000 пикселей).
    aspect_ratioCOMBOTarget aspect ratio for the megapixel-based resolution. Used only when Megapixels mode is selected. Целевое соотношение сторон для разрешения, заданного в мегапикселях. Используется только при выборе режима Megapixels.
    divisibilityCOMBO64Ensure the final width and height are divisible by this value. Гарантирует, что итоговые ширина и высота кратны этому числу.
    batch_sizeINT11–64Number of latent images to generate. Количество латентных изображений для генерации.

    Outputs (5)

    NameTypeDescription
    latentLATENT
    width_pxINT
    height_pxINT
    width_latentINT
    height_latentINT