Pixel Sort Effect
The glitch effect that rearranges your image into liquid streaks
- image
- IMAGE
Pixel sorting is that look where bright parts of an image smear into horizontal streaks, like the highlights are bleeding sideways. It's a glitch-art staple, popularized by Kim Asendorf's ASDF Pixel Sort sketch back in 2010, and this node is a faithful Python port with a pile of extra modes. You mostly reach for it as a finishing effect: run your image through it once and the result reads as "intentionally damaged," which is a surprisingly hard look to fake with prompts alone. It sits at image/effects in ComfyUI, directly on the IMAGE stream - load an image, tweak, preview.
How it works
The mechanism is simple and fast, because it's basically pure pixel-poking on the CPU. The node splits your image into rows, and each row into intervals - contiguous runs of pixels that match some criterion. Then it sorts the pixels inside each interval by a key (brightness, hue, whatever you picked) and writes them back left to right. No diffusion, no GPU math, just rearrangement, which is why a full res batch sorts in well under a second per image.
The interval dropdown controls where sorting happens. The classics are bright (sort pixels brighter than a threshold), dark, white and black - those four come straight from ASDF. The extended modes are where this port gets fun: threshold sorts everything between a lower and upper brightness band, random and waves generate arbitrary interval widths, edges uses edge detection to decide where streaks start and stop, and none sorts entire rows for the most aggressive smear.
sorting controls how pixels order within an interval. value and lightness give the classic gradient-smear, hue produces rainbow bands (pair it with random intervals for the classic "vaporwave" look), and saturation / intensity / minimum give more subtle color-driven reorderings.
The inputs that matter
You'll set three things 90% of the time:
- interval - where to sort. Start with
bright. - sorting - what key to sort by.
valueorlightnessfor the classic look,huefor rainbows. - bright_value - the threshold for
brightmode. The ASDF default of 127 is genuinely bad on most images; see below.
Everything else is optional flavor. angle rotates the image before sorting so streaks go diagonal (90 = vertical sorting, which is how the original ASDF does its two-pass look - sort at 90°, then 0°). randomness (0–100) randomly skips a percentage of intervals, which breaks up the effect and keeps it from looking mechanical. char_length sets interval width for random/waves, and loops just repeats the whole pass for a stronger smear. The output is a single IMAGE, wired straight into your preview, save, or anything else in the graph.
Installing it
cd ComfyUI/custom_nodes/
git clone https://github.com/rockerBOO/pixel-sorting.git
cd pixel-sorting
pip install -e .
# restart ComfyUI
ComfyUI Manager works too - search for "Pixel Sorting" and it'll handle the rest. The dependency story is refreshingly light: the only real requirement is pillow>=10, and ComfyUI already ships Pillow. In practice the node's __init__.py adds its own src/ to the path so it loads even if you skip the editable install, but run pip install -e . anyway - it's one command and it makes the CLI/library usage work too.
Gotchas
The big trap is that the ASDF thresholds are legacy values tuned for a 2010 sketch, not your image. Default bright_value of 127 sorts the brightest ~half of most photos, which is often way too much. The README is refreshingly honest about this and recommends values in the 75–150 range, or better yet running the pack's --analyze CLI before sorting. Even simpler: this pack ships a dedicated analyze node (see Pixel Sort Analyze) that reads your actual image and hands you suggested thresholds as INT outputs you can wire straight into bright_value and dark_value.
One other thing worth knowing: the white and black modes have bizarre default thresholds (like -12345678), leftovers from how the original sketch encoded its pixel values. Don't read anything into them - just set a sensible value or ignore those modes. bright and dark are the ones people actually use.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| interval | COMBO | bright | 9 options: threshold, bright, dark, white, black, random, +3 |
| sorting | COMBO | value | 6 options: lightness, hue, saturation, intensity, minimum, value |
| angleopt | FLOAT | 0-180–180 | — |
| randomnessopt | FLOAT | 00–100 | — |
| char_lengthopt | INT | 501–500 | — |
| loopsopt | INT | 11–10 | — |
| bright_valueopt | INT | 1270–255 | — |
| dark_valueopt | INT | 2230–255 | — |
| lower_thresholdopt | FLOAT | 0.250–1 | — |
| upper_thresholdopt | FLOAT | 0.800–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |