Nodes/Arctenoxs-Essentials_ComfyUI/Image Dimensions (Arctenox's Essentials)
ComfyUI Node

Image Dimensions (Arctenox's Essentials)

Stop Hardcoding Width and Height in Every Node

By Arctenox·Created 8 months ago·Updated 2 months ago· 1
Image Dimensions (Arctenox's Essentials)
  • image
  • image
  • width
  • height
  • batch_size
  • dimensions_str

Every time you resize an image somewhere upstream, every node that needs its dimensions becomes a guess. You type 1024 into an Empty Latent, then the image comes out at a slightly different size and the math drifts. This node ends that: it reads the actual width, height, and batch size off an IMAGE tensor and hands them to you as INT values you can wire anywhere.

How it works

ComfyUI IMAGE tensors are stored as BHWC - batch, height, width, channels. The node just unpacks those numbers and, crucially, passes the image through untouched on the image output. So you can drop it inline - image in, image out, with three numbers riding along - without changing a single pixel or adding a re-encode step.

Outputs: image (pass-through), width, height, batch_size (all INT), and dimensions_str, a ready-made string like "1024x1280 (batch: 1)" for metadata or display. Nothing to configure on the way in; the only input is image.

Where it earns its place

The classic pattern: an img2img or upscaled workflow where the resolution isn't known until runtime. Wire width and height from this node into an Empty Latent's dimensions, a KSampler's target resolution, or a controlnet preprocessing node, and you never hardcode a number again. When the source image changes, the whole chain follows it.

The pack even bakes the same idea into its VAE Encode node, which outputs dimensions alongside the latent - so if you're already going through that node you don't need this one. It's for the cases where you have a raw IMAGE and want the numbers without an encode.

The honest caveat

The dimensions_str output is a display convenience, not something you should parse. If you need the numbers in logic, use the INT outputs - that's what they're for. And batch_size is worth actually checking in batch workflows: it tells you how many frames/images you're really working with, which is often the number that bites you in an OOM.

Install

With the whole pack - ComfyUI Manager (search Arctenoxs-Essentials_ComfyUI) or:

cd ComfyUI/custom_nodes/
git clone https://github.com/Arctenox/Arctenoxs-Essentials_ComfyUI

Restart after. No model downloads. It needs only the pack's baseline deps (torch, numpy, optional psutil). The README's opening line - the pack is deprecated, being remastered into a new pack - applies here too, but a node this trivial is near-certain to survive in some form. If you want the same trick today with zero dependencies, plenty of other packs ship an equivalent "image size" node; this one just happens to sit in a pack you may already have.

CategoryArctenox Essentials/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (5)

NameTypeDescription
imageIMAGE
widthINT
heightINT
batch_sizeINT
dimensions_strSTRING