Nodes/ComfyUI illumorae/Image CLAHE (Contrast Limited Adaptive Histogram Equalization)
ComfyUI Node

Image CLAHE (Contrast Limited Adaptive Histogram Equalization)

Pull detail out of flat, muddy images

By CorvaeOboro·Created 8 months ago·Updated 6 days ago· 1
Image CLAHE (Contrast Limited Adaptive Histogram Equalization)
  • input_image
  • processed_image
clip_limit2.00
tile_grid_width8
tile_grid_height8

Flat, hazy, backlit images are a constant ComfyUI problem - you feed one into img2img or a ControlNet preprocessor and it just can't find the edges or the subject, because the contrast isn't there. Image CLAHE is the deterministic fix: it boosts local contrast, tile by tile, so detail in the shadows and highlights comes out without the washed-out, grayed look that plain global histogram equalization gives you. It's the difference between "the image, but flatter" and "the image, but you can actually see the texture in the dark corner."

This is a classic post-processing primitive - a $0, millisecond, OpenCV operation, and exactly the kind of thing you should do with a node instead of burning a diffusion pass to achieve. If your source image is underexposed or hazy, CLAHE it first, then run your pipeline.

How it works

CLAHE stands for Contrast Limited Adaptive Histogram Equalization, and every word is doing work. Normal histogram equalization stretches the whole image's contrast using one global histogram - fine on a single light source, terrible when part of the image is bright and part is dark, because it flattens everything to a uniform gray. CLAHE instead divides the image into a grid of tiles, equalizes each tile's histogram separately (that's the adaptive), and clamps how much contrast any one tile is allowed to gain (that's the limited) - so local detail pops without noise and edges getting blasted into halos.

The three knobs:

  • clip_limit (default 2) - how much contrast a tile is allowed to amplify. Higher = punchier but noisier; this is the dial you'll actually tune. Start at 2, nudge up to 3–4 if it's still flat, back off if the noise gets ugly.
  • tile_grid_width / tile_grid_height (both default 8) - the grid resolution. Finer tiles = more local adaptation = more detail and more noise. For smooth subjects keep it coarse; for textures you want fine.

The output is a single processed_image, same dimensions as the input, ready to feed your next node.

Installing it

It's part of CorvaeOboro's ComfyUI_illumorae (CC0, no model downloads). Install via ComfyUI Manager (search illumorae) or:

cd ComfyUI/custom_nodes
git clone https://github.com/CorvaeOboro/ComfyUI_illumorae

It's an OpenCV-backed node, so make sure opencv-python is present - ComfyUI ships it, and Manager installs requirements automatically for a manual clone.

Common issues

  • Image gets noisy or grainy - your clip_limit is too high or your tiles too small. Lower clip_limit toward 1–2, and if the image is already clean digital content (not a photo), CLAHE has less to work with and will amplify sensor/compression noise instead. Match it to the source.
  • Colors look off - CLAHE here works on the luminance channel while preserving color, but on heavily colored images you may see saturation shifts. It's the standard behavior; treat this as a preprocessing step and check the output before it goes downstream.
  • "Looks exactly the same" - on an already high-contrast image CLAHE legitimately has nothing to do. Reach for it on flat, hazy, or underexposed sources, not on well-lit ones.
Categoryillumorae

Inputs (4)

NameTypeDefaultDescription
input_imageIMAGE
clip_limitoptFLOAT2.00
tile_grid_widthoptINT8
tile_grid_heightoptINT8

Outputs (1)

NameTypeDescription
processed_imageIMAGE