Nodes/ComfyUI-Image-Analysis-Tools/Sharpness/Focus Score
ComfyUI Node

Sharpness/Focus Score

The 'is this actually sharp?' node you'll reach for first

By ThatGlennD·Created about a year ago·Updated about a month ago· 23
Sharpness/Focus Score
  • image
  • sharpness_score
  • edge_visualization
  • interpretation
methodHybrid
visualize_edgesfalse

Sharpness is the single most common complaint about generated images - "soft," "blurry," "waxy," "out of focus" - and it's also the most subjective-sounding one. Sharpness/Focus Score gives you a number instead of a feeling: it runs one of three classic focus metrics over the image and tells you, in plain words, whether the result reads as blurry or crisp.

It's the flagship of ThatGlennD's ComfyUI-Image-Analysis-Tools pack, and if you only install one node from the suite, this is the one. It's the generalist - Blur Detection localizes the problem, Defocus Analysis digs into the frequency domain, but this node answers the everyday question "is this output sharp enough to keep?" in under a millisecond, with zero VRAM and no models.

How it works

The method combo picks the metric, and each has its own scoring scale:

  • Laplacian: the variance of the Laplacian (second-derivative) response. High variance = lots of fine detail and crisp edges. Scores live in the hundreds; under 100 reads "Very blurry," past 700 "Very sharp."
  • Tenengrad: the mean of squared Sobel gradient magnitudes. Emphasizes strong edges. Scores live in the tens of thousands - under 10k blurry, past 50k sharp.
  • Hybrid (default): normalizes both metrics to a 0–1 scale and averages them. Under 0.2 "Very blurry," past 0.7 "Very sharp." This is the one to leave it on for general use - it's robust when no single metric dominates.

The sharpness_score output is the raw metric for your chosen method, and interpretation is a sentence like "Moderately sharp (based on hybrid of Laplacian and Tenengrad)" - handy for a display node or a text filter. The third output, edge_visualization, shows the edge response as a grayscale image, but only when visualize_edges is turned on (it defaults to false). Off, you get a black placeholder. Turn it on once or twice to see what the metric is looking at; it doesn't need to stay on.

Where it earns its keep

  • A cheap reject gate. Wire sharpness_score into a comparison node and filter out soft renders before they waste an upscale pass. (Upscaling can't restore detail that was never there.)
  • Comparing settings. Same seed, different CFG, sampler, or LoRA stack - the score tells you which one held focus.
  • Tuning step counts on distilled or turbo models, where outputs get progressively softer as you over-denoise.

The one trap: scores are only comparable within a method. A Laplacian score of 400 and a Tenengrad score of 40,000 are both "moderately sharp" but they're different numbers on different scales - don't wire raw scores from different methods into the same comparison. Pick Hybrid for cross-method sanity, and keep it consistent across your pipeline.

Install

Manager (search "Image Analysis") or:

cd ComfyUI/custom_nodes
git clone https://github.com/ThatGlennD/ComfyUI-Image-Analysis-Tools
cd ComfyUI-Image-Analysis-Tools
pip install -r requirements.txt

Restart ComfyUI. Requirements: numpy, opencv-python, matplotlib, scikit-learn, Pillow, torch - no downloads, no model files, runs on CPU in milliseconds.

Common gotchas

  • Pack won't load: scikit-learn is imported at module load by the Color Harmony Analyzer; a missing scikit-learn disables the entire pack. Windows portable: python_embeded\python.exe -m pip install scikit-learn.
  • comfy_api import error: the pack uses ComfyUI's newer node API - update ComfyUI.
  • First frame only: batches are scored on frame 0; feed video frames individually.
  • Black edge_visualization: that's visualize_edges being off, not a bug.

This node pairs cleanly with the rest of the toolkit: use it to flag soft outputs, then Blur Detection to find where they're soft and Defocus Analysis to figure out what kind of softness it is. One number starts the conversation; the maps finish it.

CategoryImage Analysis

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
methodCOMBOHybrid3 options: Laplacian, Tenengrad, Hybrid
visualize_edgesBOOLEANfalse

Outputs (3)

NameTypeDescription
sharpness_scoreFLOAT
edge_visualizationIMAGE
interpretationSTRING