Nodes/ComfyUI-QHNodes/🐟Preset Size Latent
ComfyUI Node

🐟Preset Size Latent

Pick a resolution by name instead of typing pixels

By liuqianhonga·Created 2 years ago·Updated about a year ago· 5
🐟Preset Size Latent
    • width
    • height
    • latent
    use_presettrue
    preset竖版通用 (Portrait 2:3, 1024×1536, 适合壁纸/电子书封面)
    width1080
    height1920
    swap_dimensionsfalse
    scale_factor1.0
    batch_size1

    Everyone has the same little ritual: you want a 16:9 wallpaper, so you type 1920 and 1080 into an EmptyLatentImage, or you want an Instagram Story so you go look up what size that actually is. PresetSizeLatent replaces the lookup with a dropdown - pick "Instagram Story," get 1080×1920, done - while still working like a normal empty-latent node for the sampler.

    How it works

    It's a drop-in replacement for EmptyLatentImage with a curated preset list bolted on. Flip use_preset on and pick from over 30 named presets covering portrait/landscape ratios, phone screens, video standards (4K, 1080p, cinema 2.35:1), print sizes, and specific platforms (TikTok, Instagram Story, YouTube cover, Xiaohongshu, Bilibili, and a few others). Flip it off and the width/height fields take over as a manual entry, same as the stock node. Either way it also exposes swap_dimensions to flip portrait/landscape without re-picking a preset, scale_factor to multiply the chosen size up or down, and batch_size for generating more than one latent at once.

    If none of the presets fit, the README points out the list itself is just JSON - nodes/preset_sizes.json and nodes/camera_sizes.json inside the pack - so you can add your own by editing those files directly.

    The inputs and outputs that matter

    • use_preset (BOOLEAN, default on) - toggles between the preset dropdown and manual width/height.
    • preset - the named size list; over 30 choices spanning social platforms, video, print, and general aspect ratios.
    • width / height (INT, 64–8192, step 8, defaults 1080×1920) - used directly when use_preset is off, otherwise these get overridden by the preset choice.
    • swap_dimensions (BOOLEAN) - flips whichever width/height you land on.
    • scale_factor (FLOAT, 0.1–10, default 1) - multiplies the final dimensions.
    • batch_size (INT, 1–64, default 1) - how many latents to generate at once.

    Outputs: width and height (INT, handy for wiring into any downstream node that wants the raw numbers) and latent (LATENT, wire straight into your KSampler's latent_image input).

    How to install it

    Search ComfyUI-QHNodes in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liuqianhonga/ComfyUI-QHNodes.git
    

    Restart ComfyUI. This is one of the main-repo nodes, no submodules or extra downloads needed.

    Common issues & troubleshooting

    Non-multiple-of-8 dimensions. The width/height fields step by 8 for a reason - most VAEs (Flux and SD-family included) downsample the image by a factor of 8 into latent space, so dimensions that aren't multiples of 8 either get silently rounded or produce artifacts at the edges. The node enforces the step already, so this mostly bites if you're wiring in a custom width/height from somewhere else that bypasses the widget's constraint.

    Preset dimensions don't match what you expected. Some presets are similarly named but different ratios (a handful of "portrait" and "mobile" variants sit close together in the list) - worth double-checking the actual pixel numbers shown in the dropdown label rather than trusting the name alone.

    Editing the preset JSON and nothing changes. Custom presets require a ComfyUI restart to be picked up - the list is read once when the node loads, not live from disk on every run.

    Category🐟QHNodes

    Inputs (7)

    NameTypeDefaultDescription
    use_presetBOOLEANtrue
    presetCOMBO竖版通用 (Portrait 2:3, 1024×1536, 适合壁纸/电子书封面)31 options: 竖版通用 (Portrait 2:3, 1024×1536, 适合壁纸/电子书封面), 竖版高清 (Portrait HD 5:6, 1280×1536, 适合社交平台/AI作画), 竖版长图 (Portrait Long 1:2, 1024×2048, 适合全身像/海报/建筑), 竖版手机 (Portrait Mobile, 1384×2048, 适合手机壁纸/应用截图), 竖版超清 (Portrait Ultra HD, 1536×2048, 适合精细插画/商业海报), 竖版超长 (Portrait Extra Long 9:21, 1080×2520, 适合长图文/漫画), +25
    widthINT108064–8192
    heightINT192064–8192
    swap_dimensionsBOOLEANfalse
    scale_factorFLOAT1.00.1–10
    batch_sizeINT11–64

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    latentLATENT