ComfyUI Node

ImageDims

The node that tells you an image's width and height

By taabata·Created 3 years ago·Updated 2 years ago· 259
ImageDims
  • image
  • NUMBER
  • NUMBER

ImageDims is a dead-simple utility: feed it an IMAGE, and it returns that image's width and height as two numbers. One input, two NUMBER outputs, no settings. It's the kind of node you'd expect to be built into ComfyUI by now, and mostly it is - this one just exists because the pack's own workflows needed the dimensions of a loaded image for downstream math, and it lives in this repo's LCM_Nodes/nodes category.

How it works

The source takes the first frame of the input batch, converts it to a numpy array, scales it back to 0–255, builds a PIL image, and returns image.size[0] (width) and image.size[1] (height). So two NUMBER outputs, width first, height second. Nothing clever, nothing hidden - it's a measurement node.

When you'd use it

The practical use case is feeding dimensions into something that needs to know them - a resize node, a latent-size calculator, or the pack's outpaint logic when you want to compute a canvas size based on the source image. If you're building a workflow where the output size has to match an input image's aspect ratio, wiring ImageDims into the width/height of a generation node is a clean way to keep everything consistent without hardcoding resolutions. It's also handy just for sanity-checking what an image actually is when a graph gives you surprising results.

Setup

Part of taabata/LCM_Inpaint-Outpaint_Comfy:

cd ComfyUI/custom_nodes
git clone https://github.com/taabata/LCM_Inpaint-Outpaint_Comfy
cd LCM_Inpaint-Outpaint_Comfy
pip install -r requirements.txt

Or ComfyUI Manager, search LCM_Inpaint-Outpaint_Comfy. No model downloads.

Honest take

You won't install this pack for ImageDims - plenty of general packs ship equivalent dimension nodes with cleaner outputs (including as INTs you can feed straight into ComfyUI's own latent nodes). One thing to note: the outputs are typed NUMBER, which is a looser type than INT/FLOAT, so depending on what you're wiring into, you might need a conversion node. If a workflow that uses this node loads and you just want to know what it does - now you do: width and height of the first frame, nothing more.

CategoryLCM_Nodes/nodes

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
NUMBERNUMBER
NUMBERNUMBER