Nodes/ComfyUI_NYJY/CustomLatentImage-NYJY
ComfyUI Node

CustomLatentImage-NYJY

A latent blank canvas with sane SDXL ratios baked in

By aidenli·Created 2 years ago·Updated 4 months ago· 146
CustomLatentImage-NYJY
    • LATENT
    • width
    • height
    • upscale_factor
    • upscale_width
    • upscale_height
    ratio13:19 - 832x1216
    switch_width_heightfalse
    width_override0
    height_override0
    upscale_factor1.0
    batch_size1

    Core ComfyUI's Empty Latent Image asks you to type width and height and, if you're new, you type 1024×1024 and wonder why nothing else fits. This node is the quality-of-life replacement: instead of raw numbers you pick from a curated list of 29 SDXL-native aspect ratios, each one a label like 13:19 - 832x1216 that tells you both the aspect and the pixel dimensions. It builds the empty latent the same way, but it saves you the mental math and the common mistake of feeding a sampler a resolution the model wasn't trained on. If you generate SDXL or anything built on SDXL conventions, this is the blank-canvas node you'll actually enjoy using.

    How it works

    The ratio list is the standard SDXL bucket set (the one Stability shipped with the base model) - everything from 1:2 - 704x1408 portrait phone formats up to 3:1 - 1728x576 panoramas, all multiples of 64 that divide cleanly by the VAE's 8× compression. The node takes the ratio, optionally applies overrides and an upscale factor, and creates a zero-filled latent tensor of shape [batch, 4, height/8, width/8] on the right device. A blank latent is a starting condition: the sampler denoises from it, which is exactly what you want for pure text-to-image from an Empty-Latent-style node.

    The inputs that matter

    • ratio - the dropdown with the 29 presets; default 13:19 - 832x1216 (a nice portrait). This is the one you'll set 95% of the time.
    • width_override / height_override - both default 0 (= off). Set them to force specific pixel dimensions instead of the ratio's; values snap to multiples of 8.
    • switch_width_height - swaps the width and height of the chosen ratio (portrait ↔ landscape) without hunting for the matching preset.
    • upscale_factor - multiplies the resolution, default 1. Think of it as a pre-emptive hires step: 1.5 on 832x1216 gives you a bigger latent so a high-res pass can decode finer detail.
    • batch_size - how many blank latents to stack (default 1).

    Six outputs: LATENT (the canvas), plus width, height, upscale_factor, upscale_width, and upscale_height - the resolved numbers, handy for feeding a scaling node or a text label so the graph shows you exactly what's being generated.

    Installing

    Standard NYJY pack install: ComfyUI Manager → Install via Git URL → https://github.com/aidenli/ComfyUI_NYJY, restart. No model downloads - this node only creates tensors.

    Common issues & notes

    Ratios are SDXL-family. The list is built for SDXL-style models. If you're generating with Flux or Z-Image you don't use this node's preset set the same way - those have their own preferred resolutions (this pack ships a Qwen-latent variant for Qwen-Image, and Flux workflows usually pair with a Flux-oriented empty latent). Also worth knowing: a much larger latent than the model was trained on can produce empty or duplicated regions in SDXL - the overrides and upscale factor are there to keep you sane, not to encourage pushing a 2048-wide latent through a 1024-trained model and expecting magic. Use the ratio defaults and you'll rarely go wrong.

    CategoryNYJY

    Inputs (6)

    NameTypeDefaultDescription
    ratioCOMBO13:19 - 832x121629 options: 1:2 - 704x1408, 11:21 - 704x1344, 9:19 - 704x1472, 4:7 - 768x1344, 3:5 - 768x1280, 5:8 - 768x1216, +23
    switch_width_heightBOOLEANfalse
    width_overrideINT00–16384
    height_overrideINT00–16384
    upscale_factorFLOAT1.00.125–100000
    batch_sizeINT11–100

    Outputs (6)

    NameTypeDescription
    LATENTLATENT
    widthINT
    heightINT
    upscale_factorFLOAT
    upscale_widthINT
    upscale_heightINT