Nodes/ComfyUI-JNodes/Image Size Selector
ComfyUI Node

Image Size Selector

Pick a resolution from a labeled dropdown, get width and height

By JaredTherriault·Created 3 years ago·Updated about a month ago· 91
Image Size Selector
    • width
    • height
    image_size
    use_custom_sizefalse
    custom_size_x512
    custom_size_y512
    flip_width_and_heightfalse
    multiplier1.00

    Instead of typing two numbers into an empty-latent node and trying to remember which SDXL resolutions are "blessed," you pick from a dropdown of labeled presets and this node hands you the width and height as integers. Small convenience, real time-saver - especially when you're switching between aspect ratios a lot or you can never remember whether it's 832×1216 or 896×1152 for portrait SDXL.

    It's a selector node from Jared Therriault's JNodes suite, and it comes with a genuinely long menu: 52 presets ranging from tiny 128×128 up through the common 16:9, 4:3, and 1:1 sizes, each tagged with its aspect ratio right in the label ("720x480 (16:9)", "640x480 (4:3)", and so on). If none of them fit, there's a custom-size escape hatch.

    How it works

    You choose a preset from the image_size list and the node outputs the corresponding width and height as two INT pins. A few modifiers sit on top: you can flip the dimensions for portrait/landscape, scale everything by a multiplier, or bypass the presets entirely with a custom width and height. The outputs are plain integers, so they plug straight into an EmptyLatentImage (or anything else that wants a width and a height).

    The inputs and outputs

    • image_size (enum, 52 presets) - the labeled resolution you want.
    • flip_width_and_height (default false) - swaps them, so one preset serves both orientations.
    • multiplier (default 1.0) - scales both dimensions; handy for a quick hi-res target off a base size.
    • use_custom_size (default false) with custom_size_x / custom_size_y (default 512) - ignore the presets and specify your own.
    • width and height outputs (both INT) - wire these into your latent.

    How to install it

    Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:

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

    then restart ComfyUI. No model downloads.

    Common issues & troubleshooting

    Watch the multiplier - it can produce ugly dimensions. Stable Diffusion wants dimensions divisible by 8 (and behaves best on multiples of 64). A multiplier like 1.5 on an odd base can hand you a width that isn't a clean multiple, which some samplers tolerate and some don't. After applying a multiplier, glance at the resulting numbers; if they're not divisible by 8, nudge to a preset or custom size that is.

    Custom size only kicks in when use_custom_size is true. If you typed values into custom_size_x/custom_size_y but the output still matches a preset, it's because the toggle is off. Flip use_custom_size to true to make those fields take over.

    Pick a resolution your model was trained for. This node makes it easy to select 128×128 or some exotic ratio, but the model still has opinions. SD 1.5 is happiest around 512, SDXL around 1024-equivalent areas - go far outside that and you get duplicated subjects or mush. The preset list includes small sizes for latent-upscale base passes and other tricks, not as final-render suggestions.

    It only outputs numbers. There's no image or latent coming out - just width and height. You still need an EmptyLatentImage (or equivalent) downstream to turn those numbers into something the sampler can use.

    Categorysd

    Inputs (6)

    NameTypeDefaultDescription
    image_sizeCOMBOYou can add to this list by creating a text file named 'ImageSizeSelectorResolutions.txt' in the 'ComfyUI/JNodes' folder (create it if it doesn't exist) and add new resolutions there in this format: '1280x720 (16:9), 1600x1000 (16:10), 848x480 (16:9)'. Giving an aspect ratio is optional. Ensure you always have at least one comma, even with only one added resolution.
    use_custom_sizeBOOLEANfalseIf you want to hardcode a custom size, set this to True.
    custom_size_xINT512Hardcoded width
    custom_size_yINT512Hardcoded height
    flip_width_and_heightBOOLEANfalseSet to True to flip the dimensions, for instance to create a vertical image instead of a horizontal one.
    multiplierFLOAT1.00Multiply the output width and height by this factor, rounded to the nearest even number.

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT