Complexity Score (Edge Density)
A 0β10 Complexity Score for Your Images, No Model Download Required
- image
- complexity_score
Complexity Score (Edge Density) gives your image a single number - how "complex" it looks, on a 0β10 scale - using nothing but classic image processing. No AI model, no weights download, no GPU inference for the scoring itself. If you're building workflows that rank, sort, or filter generated images, this is the cheap filter to reach for.
How it works
The mechanism is pleasantly old-school and fully visible in the source. The node converts your image to grayscale, applies PIL's FIND_EDGES filter (a simple edge-detection convolution - think a tiny Sobel-style kernel), counts what percentage of pixels land above a brightness threshold, and scales that fraction by 10 to land on a 0β10 score.
What that actually measures: edge density. A busy, detailed scene - foliage, fabric texture, crowds, fine linework - has lots of edges and scores high. A flat gradient sky or a clean portrait background has almost none and scores low. It's a blunt instrument, and it's honest about being one: "complexity" here means "how much visual edge activity is in this image," not "how aesthetically sophisticated it is." A chaotic static-filled mess scores higher than a meticulously detailed but cleanly lit studio shot. Keep that in mind before you use it as an art-quality judge.
Inputs and outputs
- image (IMAGE) - anything with an image output: a VAE-decoded result, a preview, a loaded file.
- complexity_score (FLOAT) - the 0β10 value.
That's the whole node: one input, one output. The score plugs naturally into any comparator, or into a string converter when you want it visible in a filename or Show Text node.
What it's good for
It's a sorting and filtering primitive. Batch-generate a set of images and route the ones above a complexity threshold to one path (say, a "detailed" folder) and the rest to another - the pack's image saver happily takes a prompt list and timestamp, and this score is exactly the kind of signal you can hang routing logic off. Paired with the pack's Novelty scorer you get two independent numeric views of your output: one about detail density, one about how unlike your references it is.
The honest caveat: it's a 30-line utility from a single-author hobby pack, and edge density is a 1990s image-processing heuristic, not a learned metric. It will never agree with your eye as well as a neural aesthetic scorer would - but it also doesn't need a 3.7MB .pth model or a torch import chain to run. Cheap, deterministic, no dependencies.
Installing
ComfyUI Manager (search Endless Nodes) or:
cd ComfyUI/custom_nodes
git clone https://github.com/tusharbhutt/Endless-Nodes
Restart, find it under Endless πβ¨ β Image Scoring. Good news on install: unlike the pack's Novelty scorer, this node has no extra Python dependencies - it uses only Pillow and numpy, which ComfyUI already ships. Single-author hobby pack, GPL v3; for a deterministic utility like this, low risk.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| complexity_score | FLOAT | β |