Nodes/Masquerade Nodes/Get Image Size
ComfyUI Node Runs on cloud

Get Image Size

Read width and height so you only set them once

By BadCafeCode·Created 3 years ago·Updated 2 years ago· 479
Get Image Size
  • image
  • width
  • height

Get Image Size does exactly what it sounds like - hand it an image, get its width and height back as numbers you can wire elsewhere. It's not exciting, and that's precisely why it's useful: it lets you set a resolution once, at the source (a Load Image, an Empty Latent Image, wherever your working size actually originates), and propagate it everywhere else in the graph automatically instead of retyping the same numbers into five different nodes.

That matters more than it sounds like once a workflow grows. Without this node, changing your working resolution means hunting down every place you hardcoded 1024 or 768 and updating them all by hand - miss one and you get a silent, confusing size mismatch three nodes later. With it, you update the source once and everything downstream that reads its size follows automatically. It's a small piece of plumbing, but it's the difference between a workflow that's easy to resize and one that quietly breaks every time you do.

The inputs that matter

  • image - the image to measure.

Two outputs: width and height, both plain INT values. Wire them into any node that takes an integer dimension - Create Rect Mask's image_width/image_height, Constant Mask's explicit_width/explicit_height, a Resize node, an Empty Latent Image for a second pass at the same size, or anywhere else a fixed number would otherwise need to be typed by hand.

Installing it

Get Image Size ships with Masquerade Nodes. Install via ComfyUI Manager (search "Masquerade Nodes") or manually: cd ComfyUI/custom_nodes && git clone https://github.com/BadCafeCode/masquerade-nodes-comfyui, then restart ComfyUI. It reads a tensor's shape - no models, no extra dependencies, nothing that can meaningfully go wrong in the install itself.

Common issues

There's genuinely not much to troubleshoot with this node specifically - if it's connected to a valid image, it reports its size correctly. The actual failure mode people run into isn't this node breaking, it's forgetting to use it: hardcoding a resolution in several places, changing the source image's size later, and getting mismatches downstream that have nothing to do with Get Image Size itself but would have been prevented by routing everything through it in the first place. If you're debugging a size-mismatch error somewhere else in a workflow, it's worth checking whether that workflow actually uses this node to propagate dimensions, or whether several nodes are each carrying their own independently-typed width/height that drifted out of sync.

CategoryMasquerade Nodes

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
widthINT
heightINT