Image Resolution Extractor
Read an image's dimensions and get a matching blank canvas
- image
- latent
- width
- height
- image
Image Resolution Extractor reads an image's width and height straight off the tensor and hands them to you as plain integers, while also passing the image through and producing an empty latent at the same size. It's the "get the facts about this image into the rest of the graph" node - you need those dimensions for proportional math (sizing an upscale, matching a canvas, feeding a save node's dimensions) and you'd rather read them programmatically than hardcode them or eyeball a preview.
How it works
The mechanism is tensor introspection: it pulls height and width from the image tensor's shape (the batch count becomes the latent's batch), then builds a zeroed latent at the same resolution (downscaled 8× per the standard latent convention) and hands everything back. One pass in, four outputs out - nothing is decoded or re-encoded, so it's effectively free.
Input:
image- any IMAGE tensor.
Outputs:
width/height- the image's dimensions as INTs. These are the outputs you'll actually wire into downstream math.latent- an empty latent matching the image's size and batch. Convenient when you want a blank canvas at the same dimensions (for a fresh generation at that size, for instance).image- the input image passed through unchanged, so the node can sit inline without breaking the visual data path.
The practical pattern is the pack's "Dynamic Upscaling" idea: extract width/height, run them through the Multiplication node to get a target, and size the upscale or a new latent proportionally - no matter what resolution lands on the input. It's also a quietly good debugging tool: if a downstream node is complaining about dimensions, this shows you exactly what the image carries.
Installing
This is one of the 26 nodes in ComfyUI-Flow-Assistor - ComfyUI Manager (search "Flow Assistor") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Merserk/ComfyUI-Flow-Assistor.git
Restart after cloning. Current ComfyUI required (V3-only pack); no extra dependencies.
Where people get burned
The latent output is a blank latent, not an encoded version of the image - wire it into a sampler and you'll generate fresh content at that size, not edit the image. If you want img2img, VAE-encode the passed-through image yourself. Also, the reported dimensions are the tensor's, which for a batch is the per-image size (the batch count rides along separately in the latent's batch dimension) - so a 4-image batch reports one width/height, not four. Keep that in mind if you're building batch logic off the output.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width | INT | — |
| height | INT | — |
| image | IMAGE | — |