Nodes/ComfyUI-SizeFromPresets/Size From Presets (SD1.5)
ComfyUI Node

Size From Presets (SD1.5)

SD1.5's size list in a dropdown — no typing, no math

By nkchocoai·Created 3 years ago·Updated about a year ago· 13
Size From Presets (SD1.5)
    • w
    • h
    preset

    The most boring node in the pack, and I don't mean that as a dig. Pick one of SD1.5's five size presets from a dropdown and get w and h back as integers. No latent, no batch, no RNG - it's the "Size From Presets" node for SD1.5 from nkchocoai's ComfyUI-SizeFromPresets, and boring is exactly what you want from a utility that exists to stop you from hand-typing resolutions.

    The value shows up when the numbers are all you need. Maybe you're driving a core Empty Latent Image and want it to match a preset without a risk of typoing 512 as 521. Maybe another node in the graph - a resizer, a conditioning setup, a custom tool - takes explicit width/height ints and you want a reproducible, named source for them. One dropdown, two outputs, done. It's the same idea as the SDXL version of this node, tuned to SD1.5's much smaller native resolution.

    How it works

    The dropdown is built at import time from presets/sd15.csv, which ships with five rows:

    512x512, 768x512, 512x768, 716x403, 403x716
    

    get_size() splits the selected string on 'x' and returns the two ints. That's the whole implementation - no tensors, no model calls, nothing to go wrong. The presets are SD1.5's sensible envelope: 512x512 is native, the 768 variants are the mild stretch above it, and the 716x403 pair is a 16:9-ish crop. SD1.5 starts showing off-native artifacts past about 768, so the list keeps you out of trouble without thinking.

    The one input

    • preset - the dropdown, five options. That's it.

    Outputs: w, then h, both INTs.

    Where people get burned

    There's so little surface area that the honest answer is: not much. Two caveats worth carrying anyway:

    • One preset's numbers don't divide by 8. 716x403 floors to a 712x400-decoding canvas if you feed it to a latent builder, while this node reports 716/403. The other four are exact.
    • The list is a file, loaded once. Edit presets/sd15.csv to add your own sizes, but it only takes effect after a ComfyUI restart. And keep the clone named ComfyUI-SizeFromPresets - the code locates that CSV by the exact folder path, so renaming breaks the pack (it's GPL-3.0 if you were thinking of forking it).

    Install

    ComfyUI Manager, search "ComfyUI-SizeFromPresets", install, restart. Or:

    cd <ComfyUI>/custom_nodes
    git clone https://github.com/nkchocoai/ComfyUI-SizeFromPresets.git
    

    No requirements.txt and no model downloads - the pack only needs csv, numpy, and torch, which ComfyUI already ships. Find it under the SizeFromPresets category in the node menu. If you want the same idea with a latent built for you, grab EmptyLatentImageFromPresetsSD15 instead; if you want the dice roll, there's a RandomSizeFromPresetsSD15 too.

    CategorySizeFromPresets

    Inputs (1)

    NameTypeDefaultDescription
    presetCOMBO5 options: 512 x 512, 768 x 512, 512 x 768, 716 x 403, 403 x 716

    Outputs (2)

    NameTypeDescription
    wINT
    hINT