Nodes/rgthree's ComfyUI Nodes/Image or Latent Size (rgthree)
ComfyUI Node Runs on cloud

Image or Latent Size (rgthree)

Image or Latent Size (rgthree)

By rgthree·Created 3 years ago·Updated 16 days ago· 3,317
Image or Latent Size (rgthree)
    • WIDTH
    • HEIGHT

    Image or Latent Size gives you the width and height of whatever you feed it - a pixel image or a latent - as two plain integers. The "or" is the whole trick. Normally you need one node to read an image's dimensions and a different one to read a latent's, and you have to know which you've got. This node takes either and just tells you the numbers, which is exactly what you want when you're wiring up an upscale or any stage that has to match the size of something upstream.

    Why you'd reach for it

    Dimensions drive a surprising amount of a workflow. To upscale by 1.5×, you need the current width and height so you can multiply them. To paste a generated region back into a source, you need its size. To set up a second-pass latent that matches the first, same thing. And the awkward reality is that mid-graph you sometimes have a latent (before it's decoded) and sometimes a pixel image (after), and reaching for the size of each has traditionally meant different nodes.

    This node erases that distinction. Feed it an image, feed it a latent - it reports the width and height either way. That makes it a small but genuinely handy building block for the resolution math that upscaling and multi-pass workflows are full of. (Note that a latent's reported size is in image pixels, the way ComfyUI presents latent dimensions, so the numbers line up with what your image nodes expect.)

    Inputs and outputs

    The input is dynamic - you connect either an image or a latent, and the node takes whichever you give it, so there's no fixed named-input list to memorize. Connect one source.

    The outputs are the point: WIDTH and HEIGHT, both integers. Wire them into a math node to compute a scaled target, into an empty-latent or resize node's size fields, or into a Display Int if you just want to eyeball what a stage is producing.

    Installing it

    Image or Latent Size is part of rgthree-comfy. Install through ComfyUI Manager (search rgthree's ComfyUI Nodes) or clone the repo:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rgthree/rgthree-comfy.git
    

    Restart ComfyUI afterward. No models to download, no heavy dependencies - the pack is all graph and UI code.

    Common issues

    There's very little to go wrong here, which is the appeal. The one thing to keep straight is what you're measuring: if you feed it a latent, you're getting the latent's dimensions (expressed in pixels), which is the resolution you generated at - not the resolution of some later-decoded, resized image. If your numbers seem off, check that you connected the stage you actually meant to measure.

    Second, this reads size; it doesn't change it. If you want to resize rather than measure, that's rgthree's Image Resize (for pixel images). This node is purely a readout you feed into downstream math.

    And the pack-wide caveat, worth a glance whenever any rgthree node misbehaves: if it renders oddly, check whether ComfyUI's Nodes 2.0 frontend is enabled. The Vue rewrite broke several rgthree nodes and the standing workaround is to leave Nodes 2.0 off.

    Categoryrgthree

    Inputs (0)

    No inputs

    Outputs (2)

    NameTypeDescription
    WIDTHINT
    HEIGHTINT