Nodes/comfyui-mixlab-nodes/Get Image Size ♾️Mixlab
ComfyUI Node Runs on cloud

Get Image Size ♾️Mixlab

Width, height, and a scaled minimum in one node

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
Get Image Size ♾️Mixlab
  • image
  • width
  • height
  • min_width
  • min_height
min_width512

A basic but genuinely handy utility: read an image's actual pixel dimensions so you can drive other nodes off them instead of hardcoding numbers into your graph. Where it goes slightly beyond the plain version of this node other packs ship is the min_width pairing - a way to get a floor-clamped size alongside the real one, without a separate math node.

How it works

Feed it an image and it reports back the real width and height. Separately, if you set min_width (default 512), the node also outputs a min_width/min_height pair - reading the schema, min_height is almost certainly height scaled to match whatever min_width implies, preserving the image's aspect ratio rather than just echoing a fixed number back. That gives you a ready-made "at least this big, same proportions" target size to feed into a resize node, without computing the aspect-correct height yourself.

The inputs and outputs that matter

  • image (IMAGE, required) - the image to measure.
  • min_width (INT, default 512, range 12048, step 8, optional) - your minimum-size baseline. Leave it and you get the default; set it to drive the scaled minimum outputs.

Four outputs, all INT: width and height (the image's real, unmodified size), and min_width / min_height (the scaled-minimum pair).

How to install it

Ships with the Mixlab pack.

  • ComfyUI Manager: search comfyui-mixlab-nodes, install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git, install requirements (install.bat on Windows, or ../../../python_embeded/python.exe -s -m pip install -r requirements.txt), restart.

No model downloads - this reads image metadata, nothing more.

Common issues & troubleshooting

Confused about which outputs to use. If you want the image's actual current size, use width/height. If you want a resize target that respects a minimum while keeping proportions, use min_width/min_height instead - they're not the same pair, and mixing them up is the most likely source of a resize looking wrong later in the graph.

The min-size outputs don't seem to do anything. They only reflect a value if min_width is actually wired in - left disconnected, the node falls back to its default of 512, which may not be what you expect for a much larger or smaller source image.

Downstream resize looks distorted. That's not this node's doing - it only reports numbers, it doesn't resize anything itself. If proportions look off after resizing, check the resize node's own scaling mode, not this one.

Why bother with this over hardcoding numbers? Because a workflow that reads its own image dimensions instead of assuming "everything is 512x512" survives being handed a different-sized input without silently misbehaving. That's the whole case for a node this plain - it's boring, but it's the thing that keeps a graph portable across inputs instead of quietly breaking the first time someone feeds it a portrait photo instead of a square one.

Category♾️Mixlab/Image

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
min_widthoptINT5121–2048

Outputs (4)

NameTypeDescription
widthINT
heightINT
min_widthINT
min_heightINT