Nodes/KJNodes for ComfyUI/Empty Latent Image Custom Presets
ComfyUI Node Runs on cloud

Empty Latent Image Custom Presets

Your own list of canvas sizes

By kijai·Created 3 years ago·Updated about 7 hours ago· 2,930
Empty Latent Image Custom Presets
    • Latent
    • Width
    • Height
    dimensions
    invertfalse
    batch_size1

    Everybody who generates a lot ends up typing the same handful of resolutions over and over: your go-to portrait, your landscape, the square, whatever your model likes. The stock Empty Latent Image node makes you punch in width and height by hand every time. This node replaces that with a dropdown of your saved sizes. Pick "832x1216 portrait" from a list instead of remembering the numbers.

    It's from kijai's KJNodes, the utility pack most people already have. A small quality-of-life win, but one you feel every single generation.

    How it works

    It creates an empty latent, same as the core node, but the dimensions come from a preset you select rather than fields you fill in. The preset list is loaded from a file called custom_dimensions.json in the node's folder. That's the whole trick, and it's why this node's dropdown is empty until you populate that file: the choices are yours to define. Edit the JSON, add the resolutions you actually use with friendly labels, restart, and they show up in the menu.

    It also spits the chosen width and height back out as numbers, so you can drive the rest of your workflow off the same preset, sending those dimensions to an upscaler, a ControlNet preprocessor, a resize node, without duplicating them anywhere.

    The inputs and outputs that matter

    • dimensions - the dropdown of presets, populated from custom_dimensions.json. This is the whole point of the node. If it's empty, you haven't added any presets yet (see below).
    • batch_size (default 1) - how many latents to generate at once, exactly like the core node.
    • invert (default off) - swaps width and height, so one preset serves both the portrait and landscape orientation of the same resolution. Handy: define "832x1216" once and flip invert for the landscape version.

    Outputs:

    • Latent - the empty latent, wire it into your KSampler.
    • Width and Height - the chosen dimensions as INTs, for reuse across the workflow.

    Installing it

    You likely already have KJNodes. If not: ComfyUI Manager → search KJNodes for ComfyUI → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kijai/ComfyUI-KJNodes
    pip install -r ComfyUI-KJNodes/requirements.txt
    

    Restart ComfyUI.

    Common issues

    The dropdown is empty or only has defaults. The presets live in ComfyUI/custom_nodes/ComfyUI-KJNodes/custom_dimensions.json. Open it, add your resolutions with labels, save, and restart ComfyUI so it reloads the file. The node can only offer what that file contains.

    My edits to the JSON didn't take. You have to restart ComfyUI (a full restart, not just a browser refresh) for the file to be re-read. Also make sure the JSON is still valid, a stray comma or missing bracket will make the whole list fail to load.

    An update wiped my custom presets. Since the presets live in a file inside the node folder, a git pull or Manager update can overwrite custom_dimensions.json. Keep a copy of your list somewhere outside the repo so you can paste it back after updating.

    Portrait/landscape confusion. If a preset comes out rotated from what you expected, that's invert. It's meant to let one entry cover both orientations, so double-check the toggle.

    CategoryKJNodes/latents

    Inputs (3)

    NameTypeDefaultDescription
    dimensionsCOMBO0 options:
    invertBOOLEANfalse
    batch_sizeINT11–4096

    Outputs (3)

    NameTypeDescription
    LatentLATENT
    WidthINT
    HeightINT