Nodes/ComfyUI_DD_Nodes/DD Get Image Size
ComfyUI Node

DD Get Image Size

Stop hardcoding resolutions in your workflows

By digital-divas-admin·Created 7 months ago·Updated 5 months ago· 0
DD Get Image Size
  • image
  • width
  • height

Half of ComfyUI is spending your time telling it what size things are. DD Get Image Size is the node that stops you guessing: feed it any image and it hands back that image's exact width and height as integers, ready to wire into everything that needs to know. It sounds almost too boring to install, and then you build one workflow that handles arbitrary input images and you never go back.

Why it earns its place

Think about what you do with a resize node like DD Image Resize. You type in 1024. Why? Because you assumed the source was whatever it was. If your workflow ingests images a user drops in - reference shots for img2img, faces for a detailer pass, frames from a video loader - the dimensions are unknown until runtime. Hardcoding them means every non-matching input gets silently stretched. Reading the size first and feeding it onward lets a graph adapt instead of assuming.

How it works

The mechanism is embarrassingly simple, which is the point. ComfyUI images are tensors shaped B, H, W, C (batch, height, width, channels). This node reads two numbers straight out of the shape:

  • width = the W dimension
  • height = the H dimension

No resizing, no copies, no pixel math. It's a free read.

Inputs and outputs

One required input, image (any IMAGE tensor). Two outputs, both INT:

  • width
  • height

Both are plain integers, so they plug directly into nodes that want INT: an Empty Latent Image, a resize node's width/height fields, a DD_IntMath expression like "width × 2", or anything that branches on resolution. Because these are wires, not widget values, the downstream size updates automatically every run - load a 768-wide image and the graph reshapes itself; load 1344 and it follows.

The one gotcha

The node reports whatever pixel size the tensor has at that point in the graph. Put it before your resize node and you get the source's original dimensions. Put it after and you get the resized ones. Both are correct - you just need to tap in at the right place. Also, if you're feeding it a batch of mixed-size images, it reports the first frame's dimensions. For real-world use that's almost always fine, but don't expect it to reconcile a messy batch for you (that's what a batch-builder like DD Image Power Selector is for).

Installing it

It ships in the ComfyUI_DD_Nodes pack by Digital Divas. ComfyUI Manager → search "DD Nodes", or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/digital-divas-admin/ComfyUI_DD_Nodes.git

Restart ComfyUI. The pack has an empty requirements.txt - no extra Python packages, no model downloads, nothing. One warning when searching Manager: an unrelated repo also answers to "ComfyUI-DD-Nodes", so confirm the source is digital-divas-admin/ComfyUI_DD_Nodes before installing.

CategoryDD Nodes/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
widthINT
heightINT