arthew0

← back

Pixel Sort

Pixel Sort — glitch, generativeart, visio, web

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:

  1. Compute Rec.601 luma for every pixel (byte key).
  2. Walk each scan line and find spans where luma is above the threshold.
  3. Counting-sort each span in place (stable, 256 bins).
  4. 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