Nodes/WAS Node Suite v3/Image Statistics
ComfyUI Node Runs on cloud

Image Statistics

Measure a render before you trust it

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Image Statistics
  • images
  • mean
  • median
  • minimum
  • maximum
  • contrast
  • sharpness
  • saturation
  • clipped_shadows
  • clipped_highlights
  • entropy
  • stats
  • summary

"Does this image look washed out, or is that just me?" is a question you should not be answering by eye across a thousand-frame batch. WAS Image Statistics measures brightness, contrast, sharpness, saturation, clipping and entropy for every image it's given, and hands each one back as numbers a condition node can act on. It turns "this looks off" into "entropy is 4.2, it collapsed."

Feed it images - that's the only input. Every image is measured on its own and produces its own set of outputs, and note that most of the numeric outputs are lists, one value per image in the batch. So this node is built for a batch or sequence you want to triage, not a single "what's the average brightness" readout (it does that too, happily, with a batch of one).

The outputs are a well-chosen vocabulary of failure modes:

  • mean (0.0 black → 1.0 white) and median are the pair to read together. A photograph normally lands between 0.35 and 0.6. When median sits far below mean, the picture is mostly dark with a few bright spots pulling the average up - something mean alone can't distinguish from an even mid-tone.
  • contrast is the spread of brightness around the mean, roughly 0.0 to 0.5. Below about 0.1 is a flat, hazy image - this is the number to test when deciding whether a frame needs a levels pass. It's the closest thing here to a "should I fix this?" verdict.
  • sharpness is the one with no fixed scale - it's the spread of the image's edge response, and it rises with resolution and with how much texture the subject has. Use it to compare frames within one sequence and find the soft ones, not against a number from some other workflow.
  • saturation (0.0 grey → 1.0 fully saturated) catches a render that has drifted grey, and tells a black-and-white frame from a colour one.
  • clipped_shadows and clipped_highlights report the fraction of pixels at pure black or pure white. Detail there is gone, not dark - no amount of lifting brings it back. A few percent clipped highlights is normal for a frame with a light source in it; much more is an overexposed render.
  • entropy (0.0–8.0 bits) measures how much of the tonal range is actually in use. A detailed photo sits around 7; a flat or collapsed frame sits far below. This is the single best "did the render die?" test in the list.

On top of the individual scalars there's stats, one dictionary per image holding every measurement (for Dictionary to Console, Text Dictionary Get, or writing metadata beside the file), and summary, one line of text per image ready for a log or to be burnt in with Image Draw Text. And because the outputs are numbers, you can wire mean or entropy into a condition or gate node and only run the expensive down-stream work when a frame actually passes. That's the automation use that makes this more than a curiosity - it's how you stop babysitting a batch render.

Install

Ships in WAS Node Suite v3. ComfyUI Manager, search "WAS Node Suite", or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui

Restart after. Needs ComfyUI 0.14.0+ and Python 3.10+. Nothing pip-installs and no models download - measurement runs on ComfyUI's own stack (the v2 pack's heavy install is history in v3).

Common issues

  • Numbers come back as lists and I only want one image's. Every image in the batch produces its own set, in order. Feed a batch of one if you only care about a single frame, or pair the outputs with a list-index node.
  • Sharpness "looks wrong". It has no absolute scale - only compare frames of one sequence with each other.
  • Contrast says 0.05 but the image looks fine. Trust the histogram over the eyeball; flat frames at small sizes look better than they measure.
CategoryWAS Suite/Image/Analyze

Inputs (1)

NameTypeDefaultDescription
imagesIMAGEThe images to measure. Every image is measured on its own and produces its own set of numbers.

Outputs (12)

NameTypeDescription
meanFLOATAverage brightness, 0.0 for black and 1.0 for white. A photograph normally lands between 0.35 and 0.6; well below that is an underexposed render.
medianFLOATThe middle brightness, 0.0 to 1.0. Far below the mean means the picture is mostly dark with a few bright areas pulling the average up, which a mean on its own cannot tell apart from an even mid-tone.
minimumFLOATBrightness of the darkest pixel, 0.0 to 1.0.
maximumFLOATBrightness of the brightest pixel, 0.0 to 1.0.
contrastFLOATSpread of brightness around the mean, 0.0 to about 0.5. Below roughly 0.1 is a flat, hazy picture; this is the number to test when deciding whether a frame needs a levels pass.
sharpnessFLOATHow much fine detail the picture holds, from the spread of its edge response. Has no fixed scale. It rises with resolution and with how much texture the subject has, so compare it between frames of one sequence to find the soft ones rather than against a number taken from another workflow.
saturationFLOATAverage colourfulness, 0.0 for greyscale and 1.0 for fully saturated. Useful for catching a render that has drifted grey, and for telling a black and white frame from a colour one.
clipped_shadowsFLOATThe fraction of pixels at pure black, 0.0 to 1.0. Detail there is gone rather than dark, so no amount of lifting brings it back.
clipped_highlightsFLOATThe fraction of pixels at pure white, 0.0 to 1.0. A few percent is normal for a picture with a light source in it; much more than that is an overexposed render.
entropyFLOATHow much of the tonal range is in use, in bits, 0.0 to 8.0. A detailed photograph sits around 7; a flat or nearly empty frame sits far below it, which makes this a good test for a render that collapsed.
statsDICTEvery measurement for that image in one dictionary, for Dictionary to Console, Text Dictionary Get or writing out beside the image.
summarySTRINGThe measurements as one line of text per image, for a log or a caption burnt in with Image Draw Text.