ComfyUI Node Runs on cloud

PixelSort

The glitch that won't stop being cool

By EllangoK·Created 3 years ago·Updated 2 years ago· 256
PixelSort
  • image
  • mask
  • IMAGE
direction
span_limit50
sort_by
order

Pixel sorting is the aesthetic that refuses to die: take rows (or columns) of pixels, sort them by brightness or hue, and the image comes apart into those gorgeous cascading streaks of color - the glitch look from a thousand album covers and vaporwave videos. PixelSort is a faithful implementation with a real mask input, which is the part that makes it actually controllable instead of just "mess up the whole image." It's the pack author's favorite for a reason: no other node in this pack produces anything close to it.

How it works

The mask decides where the effect applies. The image is scanned line by line (or column by column), and wherever the mask is active, the pixels in that contiguous run are sorted by a chosen property - the classic approach is to feed it a thresholded mask so only some regions get scrambled. The key detail: this implementation trims each run's endpoints so the sort only rearranges the interior, keeping the start and end pixels in place. That's what gives you those stable, sharp boundaries between sorted and unsorted regions instead of a total smear.

  • mask - an IMAGE that defines the sorted bands. Any grayscale image works; the classic is your own render thresholded, or a gradient. This is the input that makes or breaks the effect.
  • direction - horizontal sorts rows (the classic waterfall streaks), vertical sorts columns.
  • sort_by - hue, saturation, or value. Hue gives rainbow cascades; value (brightness) gives the clean monochrome streaks.
  • span_limit (0–100, default 50) - the maximum band length that gets sorted. Runs longer than this stay untouched. Lower it for controlled streaks; set it to 0 for no limit and full chaos.
  • order - forward or backward (reversed sorting).

Output is a single IMAGE.

Install

PixelSort is one of ~22 nodes in ComfyUI-post-processing-nodes.

  • ComfyUI Manager: search "post processing nodes", install, restart.
  • Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes

Restart after. No requirements.txt, no downloads. It's under postprocessing → Effects in the node menu.

Making it not look like garbage

The trap is feeding in no mask or an all-white mask, which sorts the entire image into a smear - technically a glitch, practically unusable. The move: threshold your image by value so only the highlights (or a region you pick) are sorted, leave span_limit around 20–50, and sort by value for a clean look or hue for full vaporwave. It's slow - the sort runs in Python loops per row - so don't feed it a video batch without a plan. But when you land it, it's the most striking thing this pack can do.

Categorypostprocessing/Effects

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
maskIMAGE
directionCOMBO2 options: horizontal, vertical
span_limitINT500–100
sort_byCOMBO3 options: hue, saturation, value
orderCOMBO2 options: forward, backward

Outputs (1)

NameTypeDescription
IMAGEIMAGE