Nodes/imgutils/Imgutils Metric
ComfyUI Node

Imgutils Metric

Is that image sharp or mush? Ask a number

By xiaden·Created 2 months ago·Updated 2 months ago· 0
Imgutils Metric
  • image
  • label
  • score
  • json
modeLaplacian Score

Every time you run a big batch you end up with a pile of images you can't tell apart at thumbnail size, and a few of them are secretly blurry disasters. Imgutils Metric is the boring, valuable tool for that moment: it turns "does this look sharp?" into a number you can filter on. It's part of the xiaden/comfyui-imgutils pack, a wrapper around the deepghs/imgutils anime-analysis library, and it runs no diffusion - just a fast numeric measurement on the pixels.

You pick one of two operations from the mode dropdown:

  • Laplacian Score (default) - measures sharpness by running a Laplacian edge filter and looking at the variance of the result. Flat, out-of-focus regions produce low variance; crisp lines produce high variance. This is the classic blur-detection trick, and the node bakes in a verdict: label is "sharp" when the score is 100 or above, "blurry" below that. That 100 cutoff is a rough heuristic - it works well for full-frame illustrations, so treat it as a starting point, not law.
  • Monochrome Score - reports how close the image is to grayscale (a ratio from the imgutils validation stack). Useful for spotting images that came out as flat lineart or a single-color wash when you wanted full color.

Each mode returns the same three outputs: label (STRING), score (FLOAT), and json (STRING) - the JSON is just {label, score, mode} if you want it for logging. The number you care about is score.

Why this is genuinely useful

Pair it with the pack's Imgutils Score Threshold node and you get a real filter: Metric → score out → threshold gate → boolean → a switch that only routes the sharp images onward. Run that over a hundred images and the blurry 12 remove themselves. Same trick works for detecting flat color vs. lineart in a dataset-preprocessing pass, or as a cheap "did this upscale actually add detail" sanity check before you spend more compute on the result.

Install & troubleshooting

Shared pack install:

cd ComfyUI/custom_nodes/
git clone https://github.com/xiaden/comfyui-imgutils.git
cd comfyui-imgutils
pip install -r requirements.txt

Restart ComfyUI. This pack uses the newer V3 node API, so you need ComfyUI 0.25.0+ for the nodes to appear at all. No model downloads for this particular node - the Laplacian and monochrome checks are pure math on pixels, so it's instant and works offline. If your batch is still slipping blurry frames past the filter, the fix is almost always your cutoff, not the node: an anime image with heavy flat shading scores lower naturally than a detailed mecha shot, so a single threshold for every genre is optimistic. Watch the actual score values for a few known-good images first, then set your gate.

Categoryimgutils/judge

Inputs (2)

NameTypeDefaultDescription
imageIMAGEInput image to measure quality.
modeCOMBOLaplacian ScoreMetric to compute — Laplacian sharpness score or monochrome ratio.

Outputs (3)

NameTypeDescription
labelSTRING
scoreFLOAT
jsonSTRING