Color Auto Equalize (MD)
Histogram equalize for flat images
- image
- mask
- image
mdColorAutoEqualize is the "just make it look less muddy" button. One input, one output, no parameters. It's GIMP's Auto Equalize, ported to torch: the image is converted to HSV and the V (value) channel is histogram-equalized. That's the whole trick.
Histogram equalization is the classic contrast fix - take the brightness distribution of the image, then remap it so the histogram spreads out evenly across the full range. Dark pixels get darker where there's room, bright pixels brighter, and the gray mush in the middle gets separated. Because it works on the value channel rather than per RGB channel, it boosts contrast without creating color casts the way per-channel equalize can. If your image has an alpha channel, it's passed through untouched.
Why you'd reach for it
This is the "the colors are fine, the contrast is flat" fix - distinct from auto color enhance (which stretches colorfulness) and auto stretch contrast (which stretches overall range). Equalize is the most aggressive of the three and the one most likely to overdo it on images that are already decent. On a genuinely flat render - washed-out lighting, hazy background, low-dynamic-range generation - it can be a genuine rescue. On a good image it'll push it toward "crunchy" fast.
You get one real control, and it's optional:
- image - required, your tensor.
- mask - here it acts as a per-pixel strength factor, not just a region gate. Mask value 1.0 = fully equalized, 0.0 = original V channel preserved, and values in between blend linearly. That's actually the smart way to apply this - equalize the subject, keep the background's atmosphere.
- Output: image, same shape and dtype.
One gotcha that will bite you
The source is strict about mask shape here, stricter than the other MdColorMod nodes: it requires a 3D mask (B, H, W). If you wire in a (B, H, W, 1) mask - which is what several other ComfyUI tools emit - it raises a ValueError ("Mask must be 3D"). Squeeze it first with a Squeeze node or a mask reshape. Other nodes in this pack tolerate the 4D form; this one doesn't.
Install & context
Standard MdColorMod install - search "MdColorMod" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
restart, and you're done. No dependencies, no model downloads; the whole pack is pure torch. It's part of the deterministic post-processing layer our post-processing notes describe - the point is these millisecond, no-model fixes exist so you don't burn a diffusion pass to fix contrast. One honest caveat: the pack is brand new (a month old, essentially no community presence), so if Manager can't find it yet, clone manually. And it's GPL-3.0.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor. | |
| maskopt | MASK | Optional mask to restrict the adjustment area. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The equalized image. |