Pixel Sort

Pixel sorting rearranges pixels inside one-dimensional spans along a row or column by a scalar key — usually luminance. Colors stay the same; only their order changes, so the frame histogram is preserved.
Thresholds decide which runs move. Rotation and scale aim the scan lines. On video or camera the sort can re-run every N frames so the bands crawl with motion — the classic Kim Asendorf / ASDFPixelSort look, between glitch aesthetics and structured abstraction.
Browser version: try it live in the browser — open Pixel Sort demo
How it works
This page is a CPU port of the Visio fx.pixelSort preset:
- Compute Rec.601 luma for every pixel (byte key).
- Walk each scan line and find spans where luma is above the threshold.
- Counting-sort each span in place (stable, 256 bins).
- Optional rotation aims the lines; scale can downsample before the sort; Every N frames throttles the effect on video.
Unlike smear or slit-scan, this is a real permutation of existing pixels — not a stretch of one sample. Unlike datamosh, there is no motion-vector displacement field.
Use cases
- Glitch stills — turn a photograph into Asendorf-style luminance bands.
- Live AV / webcam — streaks that track brightness structure in real time.
- Machine-perception studies — a visual way to see how a threshold carves an image into sortable runs.