🔧 Get Image Size Plus
Image dimensions, plus a resolution calculator that respects aspect ratio
- image
- width
- height
- count
There are a dozen "get image size" nodes, and this one is Zlycoris's take: it does the boring part (hand you the width, height, and batch count of any image) and then adds one genuinely handy trick - it can compute a new resolution that matches your target area while preserving the source's aspect ratio, snapped to the multiple-of-8 grid that diffusion models insist on. That second mode is the reason the "Plus" is in the name.
The inputs that matter
image(IMAGE) - anything with pixels.target_width/target_height- the desired pixel area, both defaulting to 1024.calculate_from_target- the toggle that switches modes.multiple_of-8,16,32,64, orNone(default8).
The behavior hinges on that toggle:
- Off (default): it's a plain size probe. Returns the source image's
width,height, andcount(batch size) as three INT outputs. Perfect for feeding other nodes that want explicit dimensions. - On: it computes
target_area = target_width × target_height, keeps the source's aspect ratio, solves for the matching width/height, then snaps each to the nearestmultiple_of. Want a 1MP image (1024×1024 target) from a 1216×832 source? You get back 1216×832-equivalent area at whatever multiple you picked.
What the outputs wire into
All three are INTs: width, height, count. The classic use is feeding an empty latent - generate at a resolution that matches an input image's footprint without distortion. This is the workflow glue behind the "keep the aspect ratio of my reference image" pattern that shows up in every Z-Image upscale and i2i pipeline, since Z-Image's native sweet spot is roughly 1–2MP and staying inside it (or snapping to 8) avoids the smearing you get past the ceiling.
Install
ComfyUI Manager (search ComfyUI-Zlycoris) or:
cd ComfyUI/custom_nodes
git clone https://github.com/TripleHeadedMonkey/ComfyUI-Zlycoris.git
Restart ComfyUI. Pure utility node - no models, no heavy deps beyond what the pack already installs.
Gotchas
calculate_from_targetoff gives you the raw dimensions, no snapping. If you toggle it on expecting snapping but left the target at 1024×1024, you'll get whatever area matches - that's by design, not a bug.- Rounding can land you one pixel off the grid, and integer rounding of
sqrtmath means 1024×1024 targets sometimes return 1023 or 1025 after snapping. For an empty-latent node that's worth knowing, though ComfyUI generally tolerates the difference. - The
countoutput is the batch size of the tensor, not the number of frames in a video. Feed it a batch of 4 images and you'll get 4, which is exactly what it says on the tin. - One oddity: the class registers as
GetImageSizePlus+(the plus is part of the class name), so if you're importing or searching by class, include the trailing+.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_width | INT | 10240–8192 | — |
| target_height | INT | 10240–8192 | — |
| calculate_from_target | BOOLEAN | false | — |
| multiple_of | COMBO | 8 | 5 options: 8, 16, 32, 64, None |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| count | INT | — |