Nodes/Painting Coder Utils/Image Size Creator 📏
ComfyUI Node

Image Size Creator 📏

SDXL's optimal resolutions as a dropdown, not arithmetic

By jammyfu·Created 2 years ago·Updated about a year ago· 16
Image Size Creator 📏
    • resolution
    • width
    • height
    mode
    resolution
    scale_factor1.0

    Everyone knows you should generate at a resolution the model was trained on, and everyone also knows that "just type 1152×896" is how you get it slightly wrong from memory. Image Size Creator turns that into a picker: three orientation choices, nine SDXL-optimal aspect ratios, done. It's the "give me the numbers" node - no latent, no image, just width and height (and a resolution string) you can wire anywhere.

    It's part of the Painting Coder Utils pack, and it's the parent of two other nodes in the same pack: Image Latent Creator 🎨 builds on it to actually create a latent, and Image Size Creator Plus ✨ extends the ratio catalog with Midjourney sizes.

    How it works

    Pick mode (Landscape / Portrait / Square) and a resolution, and the node looks up the base pixel size for that ratio from a hardcoded SDXL table - 1:1 → 1024×1024, 3:2 → 1216×832, 7:4 → 1344×768, 12:5 → 1536×640, and so on. scale_factor (0.1 to 10, default 1) multiplies the base size, and that's the whole calculation. The front-end filters the resolution dropdown by orientation, so you never pick a portrait ratio while set to Landscape.

    It returns three things: the resolution string (like "3:2 (1216x832)"), the width, and the height. Nothing is generated - this is pure metadata. That's the design: feed the width/height into an Empty Latent Image, an Image Resize, or a Conditioning area node, and you have one consistent canvas size flowing through the graph.

    Inputs and output

    • mode - Landscape, Portrait, or Square.
    • resolution - one of the nine SDXL optimal ratios.
    • scale_factor - optional multiplier.
    • Outputs: resolution, width, height.

    Where you'll use it

    Any workflow where several nodes need to agree on a canvas size. Wire width and height into your latent creator and your conditioning area, and you can't drift out of sync. If you just want a fresh empty latent to sample, grab Image Latent Creator instead - this one is for when you need the numbers, not the latent.

    Honest take: for a single fixed size you can type the values directly and skip the node. It earns its place in batch or multi-node setups where the size needs to be defined once and shared, or where you want the orientation-filtered dropdown instead of remembering 9:7 vs 7:9.

    Install

    ComfyUI Manager → Painting Coder Utils, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jammyfu/ComfyUI_PaintingCoderUtils.git
    

    Restart ComfyUI. No models, no API keys - the pack's dependencies (numpy, Pillow, torch, gradio) ship with any working ComfyUI. Old-workflow gotcha: v0.3.0 renamed the pack's node namespace, so inherited JSON may not resolve these nodes - jammyfu's fixer at docs/fix/workflow_fixer.html repairs it.

    Category🎨Painting👓Coder/🖼️Image

    Inputs (3)

    NameTypeDefaultDescription
    modeCOMBO3 options: Landscape, Portrait, Square
    resolutionCOMBO9 options: 1:1 (1024x1024), 9:7 (1152x896), 7:9 (896x1152), 3:2 (1216x832), 2:3 (832x1216), 7:4 (1344x768), +3
    scale_factorFLOAT1.00.1–10

    Outputs (3)

    NameTypeDescription
    resolution*
    widthINT
    heightINT