Nodes/Img Label Tools/Image Equalizer
ComfyUI Node

Image Equalizer

Make every image in a batch the same size — without wrecking them

By rjgoif·Created 9 months ago·Updated 2 months ago· 5
Image Equalizer
  • images
  • IMAGE
size_modegrow
upscale_methodlanczos
keep_proportionpad
pad_colorblack
crop_positioncenter

Image Equalizer is the foundation this pack is built on, and the one node worth stealing even if you never touch the rest. It takes a batch of images of different sizes and makes them all the same dimensions. That sounds boring until you need it: grid layouts require uniform cells, batches fed to training scripts often expect one resolution, and every comparison post dies on mismatched sizes. The author was upfront about the lineage - it's inspired by KJNodes' image utilities - and it does the job cleanly.

The core choice is size_mode. grow finds the largest width and height in the batch and expands everything to match. shrink does the opposite, matching the smallest. Neither is universally right: grow is lossless (nobody gets downscaled, you just add canvas) but a single huge image makes everything huge; shrink gives you compact uniform thumbnails but throws away detail from the bigger images. Pick by what the result is for.

How the sizing actually works

Beyond the raw mode, keep_proportion decides how each image reaches the target:

  • pad (default) - scales to fit inside the target box, preserving aspect ratio, and fills the leftover space with pad_color. Safe and predictable.
  • stretch - resizes directly to the target, ignoring aspect ratio. If the inputs are wildly different shapes, expect distortion.
  • resize - scales to fit within a bounding box; the catch is results may not all be the same size. Fine if you only need a ceiling, not a grid.
  • crop - scales to fill the target and crops the overflow. Great for thumbnails where you want the whole frame filled.
  • total_pixels - tries to keep each image's pixel count roughly constant, so the result depends on each image's own aspect ratio.

For upscaling, upscale_method gives you the usual suspects (nearest-exact, bilinear, area, bicubic, lanczos); lanczos is the default and the right call for grown images.

Pad color and crop position

If you're padding, pad_color matters more than you'd think. black, white, and gray are self-explanatory, but the interesting two are average - a gamma-corrected weighted mean of the whole image - and average_edge, the weighted mean of just the peripheral 5%. That last one is the trick: it produces padding that blends with the image's own border, so letterbox bars almost disappear. If you're building a gallery grid, average_edge is the one you'll actually use; hard black bars look like a bug in your workflow.

crop_position (center/top/bottom/left/right) picks which part survives when crop does its thing. Center is the default and usually right; top is your friend if your subjects are heads-up portraits.

Install

It's part of the Img Label Tools pack: ComfyUI Manager → search "Img Label Tools" → install, or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/rjgoif/ComfyUI-Img-Label-Tools

Restart ComfyUI after either. No models, no extra dependencies - Pillow and PyTorch are already part of ComfyUI.

Gotchas

The whole equalize pass runs on CPU, so a big batch of large images is slow - don't throw 50 4K renders at it and expect speed. And remember grow grows to the largest dimension in each axis independently, so one oddly tall image makes the entire batch taller. If that surprises you, that's why the output is a list of same-size images you can then feed into Image Array, Label Image, or any batch-ready consumer.

CategoryImage Label Tools

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
size_modeCOMBOgrow2 options: grow, shrink
upscale_methodCOMBOlanczos5 options: nearest-exact, bilinear, area, bicubic, lanczos
keep_proportionCOMBOpad5 options: pad, stretch, resize, crop, total_pixels
pad_colorCOMBOblack5 options: black, white, gray, average, average_edge
crop_positionCOMBOcenter5 options: center, top, bottom, left, right

Outputs (1)

NameTypeDescription
IMAGEIMAGE