Nodes/ComfyUI_PRNodes/EmptyLatentImageScaleBy
ComfyUI Node

EmptyLatentImageScaleBy

An empty latent that lies about its size (on purpose)

By pikenrover·Created 2 years ago·Updated about a year ago· 2
EmptyLatentImageScaleBy
    • LATENT
    • WIDTH
    • HEIGHT
    width512
    height768
    batch_size1
    scale_by2.0

    Let's get the honest description out of the way first: this node does not scale anything. Despite the name, the latent it produces is exactly the size you type into width and height. What scale_by changes is only the WIDTH and HEIGHT numbers it reports out the side. That sounds like a bug, but it's deliberate, and it exists to solve a real annoyance if you post images to CivitAI.

    The pack's philosophy is: generate at a modest base resolution, upscale, and then make the saved metadata record the final posted size - the size someone looking at your CivitAI image is actually seeing. The stock EmptyLatentImage has no way to say "my latent is 512×768 but the finished image will be 1280×1920." This node is that lie made into a feature.

    How it works

    It allocates a tensor of zeros in latent space: [batch_size, 4, height/8, width/8]. The /8 is standard - that's the VAE latent compression factor, and it's the same math every empty-latent node uses. Then, purely for reporting, it computes scaled_width = width * scale_by and scaled_height = height * scale_by and hands those out as WIDTH and HEIGHT. The latent tensor itself never changes. In the pack's example workflows this works because the graph upscales the decoded image to exactly those reported dimensions before saving (that's what ImageScaleTo is for), so the metadata ends up honest - the size claim is verified by the final resize.

    Inputs and outputs

    Four inputs, and only one of them is interesting:

    • width (512) and height (768) - the base generation size, stepped in multiples of 8. This is what the actual latent is.
    • batch_size - how many empty latents, default 1.
    • scale_by (2.0, range 1.0–4.0, step 0.1) - the number that gets multiplied into the reported size. Set it to your upscale factor.

    Outputs are LATENT, plus the two reporting values WIDTH and HEIGHT.

    Install and gotchas

    Standard for the pack - ComfyUI Manager, search "ComfyUI_PRNodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pikenrover/ComfyUI_PRNodes
    

    Then restart. No pip deps, no model downloads.

    The trap is using it standalone. If you drop this into a workflow thinking "scale_by 2 means a bigger latent," your sampler will render at the base resolution and your metadata will claim twice that. The WIDTH/HEIGHT outputs are for the pack's Save Image w/Metadata node and anything that treats them as "the size we'll present." If you actually want a bigger latent - a real upscale before the hires pass - use EmptyLatentImage with bigger numbers, not this node. It's a paperwork helper, not a resize tool, and the sooner you stop expecting it to resize things, the happier you'll be.

    Categorylatent

    Inputs (4)

    NameTypeDefaultDescription
    widthINT51216–16384
    heightINT76816–16384
    batch_sizeINT11–4096
    scale_byFLOAT2.01–4

    Outputs (3)

    NameTypeDescription
    LATENTLATENT
    WIDTHWIDTH
    HEIGHTHEIGHT