ComfyUI Node

Histogram

The Histogram node in ComfyUI

By jkrauss82·Created 3 years ago·Updated a day ago· 9
Histogram
  • images
  • IMAGE
modelightness

Most post-processing nodes change your image. This one just tells you the truth about it. ULTools' Histogram grades nothing - it renders the brightness distribution of your image as a clean 1600×400 dark-theme chart and hands it back as an IMAGE tensor. Which means you wire its output into a PreviewImage node and finally see what's wrong before you start fixing it blind.

That's a more useful skill than it sounds, because AI output has a recognizable failure signature: the washed-out, flat generation where every tone is huddled in the middle of the range. A histogram shows that instantly as one big hump with nothing near either end. More importantly, it shows you which end is the problem - crushed shadows, clipped highlights, or a midtone log-jam - and that tells you which deterministic fix is the right one. Flat and lifeless? Reach for a gamma or sigmoid curve, not the additive brightness slider that just clips. Cold tint? That's a channel problem, and you'll see it in rgb mode before your eyes register it.

How it works under the hood: each input image is converted to LAB, and in lightness mode the node plots the L channel as a single white curve. In rgb mode it instead draws the red, green and blue channels overlaid as three translucent curves - the way to see a color cast, because a blue curve sitting far right of red is why your snow looks cold. Matplotlib does the drawing (it's in the pack's requirements.txt), every chart is resized to a uniform 1600×400 so a batch stays cat-able, and the lot comes back as an IMAGE batch. Feed it N images, get N charts out.

The node is deliberately thin. Inputs are just images (any IMAGE, typically the VAE Decode output) and mode (lightness by default, or rgb). Its single output is IMAGE - wire it into a PreviewImage or Save node. One thing beginners trip on: Histogram is not an output node, so with nothing downstream it displays nothing. No preview node, no chart.

The way you actually use it is in pairs. Run one Histogram on the raw decode and a second on your graded output, preview both, and compare the curves before and after. If you're about to re-roll a seed because "the colors are off," ninety seconds with the rgb curves beats guessing - and it tells you whether a color-match node can fix it deterministically instead. It's also the right check after an upscale, to confirm the tonal range survived the trip.

Install is shared with the rest of the pack: search ComfyUI Manager for "ULTools", or clone https://github.com/jkrauss82/ultools-comfyui into ComfyUI/custom_nodes, run pip install -r requirements.txt, and restart. Histogram shares a file with Clahe and UnsharpMask, so if those three nodes are all missing after install, the cause is one missing dependency - kornia, which the requirements file forgets to list (pip install kornia fixes it).

It's a small node with a single dropdown, and that's the right size. It won't fix a thing on its own - it's the eyeball before the gamma, the CLAHE, or the color-match node does the work. But half the "why does my output look bad" posts on the subs would answer themselves if people ran one of these first.

Categoryimage

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOlightness2 options: lightness, rgb

Outputs (1)

NameTypeDescription
IMAGEIMAGE