Nodes/ComfyUI-Zlycoris/🔧 Get Image Size Plus
ComfyUI Node

🔧 Get Image Size Plus

Image dimensions, plus a resolution calculator that respects aspect ratio

By TripleHeadedMonkey·Created 7 months ago·Updated 7 months ago· 4
🔧 Get Image Size Plus
  • image
  • width
  • height
  • count
target_width1024
target_height1024
calculate_from_targetfalse
multiple_of8

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, or None (default 8).

The behavior hinges on that toggle:

  • Off (default): it's a plain size probe. Returns the source image's width, height, and count (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 nearest multiple_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_target off 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 sqrt math 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 count output 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 +.
Categoryessentials_mb/image utils

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
target_widthINT10240–8192
target_heightINT10240–8192
calculate_from_targetBOOLEANfalse
multiple_ofCOMBO85 options: 8, 16, 32, 64, None

Outputs (3)

NameTypeDescription
widthINT
heightINT
countINT