ComfyUI Node

Equalize

One input, instant contrast — histogram equalization

By lilquail·Created 9 months ago·Updated 9 months ago· 1
Equalize
  • image
  • IMAGE

Equalize is the smallest node in this pack and it does exactly one thing: histogram equalization, which stretches the image's brightness distribution so details hiding in a narrow tonal range become visible. One input in, one image out, no settings to argue with.

When do you reach for it? When a map looks like a flat gray wash. A height map that's crushed into the 0.2–0.5 range, a low-contrast mask, a rough AO pass - run it through Equalize and the structure pops out. It's the "make the hidden detail visible" move before you decide whether that detail is actually useful.

How it works

The node is a thin wrapper over OpenCV's equalizeHist, applied per channel to the input tensor. The mechanism is classic: it builds the image's histogram, then remaps pixel values via the cumulative distribution so output levels are spread as evenly as possible across the full 0–1 range. No parameters, no kernel, no tunables - the image's own distribution decides the mapping.

Inputs and outputs

  • image - the input tensor (any IMAGE).
  • Output: a single IMAGE, same dimensions, contrast redistributed.

That's the whole API. If you need control - black/white points, an offset, a target histogram - the same pack has Height Map Adjust (levels + offset) and Histogram Matcher (match to a reference). Equalize is the zero-config version.

Install

Ships in ComfyUI-Leputen-Utils:

cd ComfyUI/custom_nodes
git clone https://github.com/lilquail/ComfyUI-Leputen-Utils

Restart ComfyUI and find it under Leputen-Utils → Image. Deps (scipy, opencv-python, onnxruntime, imageio) auto-install on first launch - OpenCV is the dependency that actually does the work here.

Gotchas

  • It's per-channel. On a color image each channel gets equalized independently, which shifts hues. That's rarely what you want for an albedo, and usually fine (even good) for a grayscale map where channels are identical anyway. If you're equalizing a color image for looks, run it on a converted grayscale or use it only on masks/height maps.
  • Amplifies noise. If your input is noisy, equalization will happily stretch the noise into view. Run a light blur first if that happens.
  • Not adaptive. A single global histogram can wash out when one region dominates the image. For those cases, a local/adaptive approach would do better - but this node isn't it.

Honest verdict: for a texture pipeline it's a "sometimes useful" utility, not a daily driver. But when a height map reads as a flat gray sheet and you need to actually see what's in it, there's nothing faster to drop in.

CategoryLeputen-Utils/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGEThe input image tensor to apply histogram equalization to.

Outputs (1)

NameTypeDescription
IMAGEIMAGE