ComfyUI Node

AesthetlcScoreSorter

Sort two images by taste, in one dumb honest node

By strimmlarn·Created 3 years ago·Updated 2 years ago· 35
AesthetlcScoreSorter
  • image
  • score
  • image2
  • score2
  • IMAGE
  • SCORE
  • IMAGE
  • SCORE

You've got two images and a score for each. You want the "better" one to come out on top. That's it. That's the entire job of AesthetlcScoreSorter - it compares two image+score pairs, swaps them if needed, and returns the higher-scoring one on the first output. There's no neural net in here, no re-scoring, no sorting algorithm. It's a two-input compare with a swap, and it's the second most useful node in this pack precisely because it's so boring.

Boring is good, because it's also transparent. You can see exactly what it did, you can chain them, and you can trust the routing.

How it works

The mechanism is one if statement: if score >= score2, pass everything through untouched; otherwise return (image2, score2) first. That's the whole thing. The scores come in via the pack's SCORE type (which is a number 0–1000 out of CalculateAestheticScore), and the images pass through byte-for-byte - nothing gets re-encoded or re-generated, so it's effectively free to run.

The inputs are exactly four, and the outputs mirror them:

  • image, score - pair #1
  • image2, score2 - pair #2

Outputs: IMAGE, SCORE (the winner), then IMAGE, SCORE (the loser). Wire the winner onward and the loser to a dead end or a preview.

The one real limitation: it only sorts pairs

Here's where people get annoyed. This node compares exactly two things, not a batch. If you generated four images and want them ranked top to bottom, you can't feed four in - the schema takes two. The workaround is chaining: sort (A, B), sort (C, D), then sort (winner1, winner2) to crown the overall best. That's a mini tournament bracket of three nodes for four images, and it's exactly what the pack's example workflow ("sort 4 images top to bottom") does.

It works, but it's fiddly, and it's the honest reason this pack stays niche: once you're ranking real batches, single-purpose pairwise sorters start to feel like duct tape. The community has mostly drifted to PickScore-based nodes for batch ranking, which handle a whole batch at once. For two images, or a bracket you don't mind building, this is dead simple and easy to read - for a 20-image batch, it's the wrong tool.

Install and wiring

Installing this node means installing the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/strimmlarn/ComfyUI-Strimmlarns-Aesthetic-Score
pip install -r requirement.txt   # the file is requirement.txt, not requirements.txt

Or use ComfyUI Manager and search "Strimmlarns". Restart, and you'll find all four nodes under the aestheticscore category.

The typical graph: generate → CalculateAestheticScore on each image → pair the scores up → feed this sorter → send the winner to a Save Image. Because it needs two scores, you'll usually run the scoring node twice or parallelize your generation. And note the typo in the node name - "Aesthetlc" with the l and c swapped - is intentional (well, inherited), so when you search for it in the node menu, that's the spelling you type.

Common issues

There's almost nothing that can go wrong here because the node does almost nothing. The one real gotcha: the scores you feed in have to actually be from this pack's SCORE type. If you wire in a plain NUMBER or an integer from another node, ComfyUI will complain about mismatched types at the socket - that's what ScoreToNumber exists for, converting the pack's score to a generic number, not the other way around. And since images pass through unmodified, don't expect it to fix an ugly image. It only tells you which of two ugly images is less ugly.

Categoryaestheticscore

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
scoreSCORE
image2IMAGE
score2SCORE

Outputs (4)

NameTypeDescription
IMAGEIMAGE
SCORESCORE
IMAGEIMAGE
SCORESCORE