ComfyUI Node

FL PixelSort

The classic glitch-art pixel-sorting effect, built in

By filliptm·Created 3 years ago·Updated about 5 hours ago· 628
FL PixelSort
  • images
  • IMAGE
direction
threshold0.50
smoothing0.10
rotation0

Pixel sorting is one of the oldest tricks in the digital-glitch playbook - take an image, pick intervals of pixels along a row or column, and sort them by some value instead of leaving them where they were. The result is that streaky, melted-photograph look you've seen on glitch-art Instagram for over a decade. FL_PixelSort is Fill-Nodes' take on it, and it's a genuinely fun node to drop at the end of a generation pipeline when you want texture instead of a clean render.

Fill-Nodes overall is a huge, one-person grab-bag pack (filliptm, Patreon handle Machinedelusions) covering everything from PDF merging to Gemini API calls, and this is one of its more purely decorative corners - a VFX node with no external dependency drama, just image-in, glitch-out.

How it works

It sorts pixels by HSV saturation, within intervals it detects along edges - not the whole row at once, but chunks bounded by where the image has meaningful contrast. That's the difference between classic pixel sorting (which just picks a global sort direction and value) and a version tuned by an edge threshold: you get sorted streaks that respect where the image actually has structure, rather than one uniform smear top to bottom.

The inputs and outputs that matter

  • images - the only required input, your source batch.
  • direction (Horizontal / Vertical) - which way the sort intervals run. Horizontal streaks the image left-to-right; Vertical streaks it top-to-bottom. Try both, they read very differently on the same image.
  • threshold (default 0.5, 0–1) - the edge-detection sensitivity that decides where sortable intervals start and stop. Lower it and you get longer, more dramatic streaks because fewer edges break up the sort; raise it and the effect gets choppier and more localized.
  • smoothing (default 0.1, 0–1) - softens the transition at the edges of each sorted interval so the effect doesn't look like a hard cut.
  • rotation (default 0, integer 0–3) - rotates the image in 90° steps before sorting and back after, which is the cheap way to get diagonal-feeling streaks without writing a whole diagonal-sort algorithm.

Output is a single IMAGE - drop it straight into a preview or save node, or stack it with more VFX nodes (dithering, halftone, glitch) for a heavier effect.

How to install it

Through ComfyUI Manager, search "Fill-Nodes" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
pip install -r ComfyUI_Fill-Nodes/requirements.txt

then restart ComfyUI. This node itself is lightweight (numpy/PIL-level work), so it's a fine one to try first if you're wary of the pack's heavier API dependencies elsewhere.

Common issues & troubleshooting

"It barely changed the image." Usually threshold is too high - the detector is finding lots of edges and only sorting tiny intervals between them. Drop it toward 0.2–0.3 for a much more visible streaking effect.

"It's too chaotic / unrecognizable." Go the other way - raise threshold, and add a touch of smoothing so the sorted regions blend instead of hard-cutting against the untouched image.

Flat, low-contrast source images barely sort at all. Since the effect is driven by saturation and edge detection, a very flat or desaturated image gives the algorithm little to grab onto. Boost contrast/saturation slightly upstream (FL_ImageAdjuster is in the same pack) if you want a strong result on a muted photo.

Category🏵️Fill Nodes/VFX

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
directionoptCOMBO2 options: Horizontal, Vertical
thresholdoptFLOAT0.500–1
smoothingoptFLOAT0.100–1
rotationoptINT00–3

Outputs (1)

NameTypeDescription
IMAGEIMAGE