Nodes/RES4LYF/SetImageSizeWithScale
ComfyUI Node Runs on cloud

SetImageSizeWithScale

One node for a base resolution and its scaled-up counterpart

By ClownsharkBatwing·Created 2 years ago·Updated 17 days ago· 1,222
SetImageSizeWithScale
    • width
    • height
    • width_scaled
    • height_scaled
    width1024
    height1024
    scale_by1.00

    A small, purely mechanical node, and useful for exactly one reason: it's a shortcut for the extremely common pattern of "generate at X, then upscale by a factor" without you doing the multiplication yourself or wiring up a separate math node. Set a width, a height, and a scale factor, and you get both the base resolution and the scaled resolution as two clean pairs of numbers, ready to feed two different stages of a workflow.

    Where this actually helps

    If you've built a generate-then-hires-fix pipeline - base pass at 1024×1024, then an upscale pass at 1.5x for a 1536×1536 final image - you normally need to either hardcode both sets of numbers separately (and remember to update both if you change the scale) or bolt on a couple of INT math nodes to compute the scaled values. This node does that arithmetic for you and exposes all four numbers as outputs, so a single width/height/scale_by change upstream propagates correctly to both your base latent size and your upscale target.

    The inputs and outputs that matter

    • width (default 1024) and height (default 1024) - your base resolution.
    • scale_by (default 1, step 0.01) - the multiplier. 1.5 on a 1024×1024 base gives you 1536×1536 scaled; 2.0 doubles it.

    Outputs: width and height (your base values, passed through unchanged so you can wire your initial latent from the same node), plus width_scaled and height_scaled (the multiplied result - feed these into your upscale stage's target size).

    How to install it

    Comes bundled with RES4LYF - no separate install for individual nodes. Via ComfyUI Manager: search "RES4LYF", install, restart. Manually:

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

    Restart ComfyUI afterward. There's no model or heavy dependency involved here - this is a pure arithmetic utility node, no VRAM cost, no download.

    Common issues & troubleshooting

    Scaled dimensions aren't a multiple of 8 (or 64) and something downstream complains. Diffusion models generally want latent dimensions divisible by 8 at minimum (some architectures want more), and this node does plain floating-point multiplication with no rounding-to-a-clean-number logic beyond your scale_by step of 0.01. If your scaled output lands on an odd number, adjust your base resolution or scale factor slightly rather than expecting the node to snap to a valid size for you.

    You expected this to actually resize an image. It doesn't - despite the category name, this node produces integers, not pixels. If you need an actual image resize, you want an image-scaling node (or, for latents heading into unsampling-style workflows, something like PrepForUnsampling's resize handling) - this one is purely for computing the two sets of dimensions you'd feed into other nodes.

    Nothing changes when you edit scale_by. Double check you're wiring width_scaled/height_scaled - not the plain width/height outputs - into whatever stage is supposed to use the scaled size. It's an easy node to accidentally connect the wrong pair of outputs from, since all four are just INT and look identical on the wire.

    CategoryRES4LYF/images

    Inputs (3)

    NameTypeDefaultDescription
    widthINT10241–10000
    heightINT10241–10000
    scale_byFLOAT1.000–10000

    Outputs (4)

    NameTypeDescription
    widthINT
    heightINT
    width_scaledINT
    height_scaledINT