Nodes/DJZ-Nodes/Djz Datamosh V6 (Pixel Sorting)
ComfyUI Node

Djz Datamosh V6 (Pixel Sorting)

Sobel edges carve the segments

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Djz Datamosh V6 (Pixel Sorting)
  • images
  • IMAGE
threshold128

Pixel sorting is the glitch look everyone knows even if they can't name it: the long vertical smears where the sky or a wall gets "combed" into columns of brightness, while the actual subject stays recognizably intact. DjzDatamoshV6 is the honest, classic implementation of that effect - edge detection chops the image into segments, and everything inside each segment gets re-sorted by luminance. It's the middle child of the DJZ datamosh family: more of a real image effect than V5's frame reordering, and simpler to reason about than V7's four-mode version.

How it works

The node converts each frame to luma (the standard 0.2126/0.7152/0.0722 RGB weights), runs a Sobel operator in both directions to find edges, and uses a threshold to decide what counts as a boundary. Pixels between boundaries form segments; within each segment, pixels are sorted by their luma values and written back in that order - but sorted across all three color channels together, so the colors within a sorted run stay coherent rather than turning into rainbow noise. The effect only exists where the image lets it: strong edges survive, smooth regions get dragged into gradients.

The single input that matters is threshold (0–255, default 128). It's inverted from what you might expect:

  • Low threshold (0–50) - almost everything looks like an edge, so segments are tiny and the effect is subtle. Detail preserved.
  • Default (128) - a good balance.
  • High threshold (150–255) - few edges, huge segments, long dramatic smears. This is the "I want it to look aggressively broken" range.

Everything else is input images (a batch, processed frame by frame with the same threshold) and output IMAGE. That's the whole node. No seeds, no rotation, no multi-pass. It's deterministic: same input, same threshold, same result, every time.

Where it fits

In practice V6 is what you reach for when you want the pixel-sort look with minimum fiddling. Batch it over frames of a video and the effect stays consistent across the shot because the threshold applies uniformly - a nice property when you're trying to sell a "corrupted footage" illusion rather than an acid trip.

Two things to know. First, the node imports scipy for the Sobel operator, and scipy is not in the pack's requirements.txt - it's usually already in a ComfyUI environment (torch pulls in a lot), but if the node doesn't appear after install, that's the missing piece: pip install scipy. Second, this is a per-pixel CPU loop over segments, so big 4K batches get slow. 1024x1024 is comfortable; don't plan on processing a 4K video frame-by-frame at real-time speed.

If you outgrow it, DjzDatamoshV7 in the same pack is the upgraded version - hue, saturation and laplacian sort modes, rotation, multi-pass, and a seed. But for "glitch my footage without a fight," V6 with the threshold cranked up is genuinely hard to beat.

Categoryimage/effects

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
thresholdFLOAT1280–255

Outputs (1)

NameTypeDescription
IMAGEIMAGE