Nodes/DJZ-Nodes/Djz Pixel Sort V8 Advanced
ComfyUI Node

Djz Pixel Sort V8 Advanced

The name says datamosh, the node does pixel sort — and it's the good kind of glitch

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
Djz Pixel Sort V8 Advanced
  • images
  • mask
  • IMAGE
sort_mode
threshold0.50
rotation-90
multi_passfalse
seed42

Let's clear up the naming before anything else: DjzDatamoshV8 is not datamoshing. Real datamoshing corrupts the motion-compensation data between compressed video frames so pixels smear like melting plastic. This node is pixel sorting - it rearranges the pixels within a frame, which produces the streaky, waterfall-of-color look that gets lumped in with glitch art. It's the eighth generation of DJZ's datamosh suite and honestly the one worth using, because it gives you a mask, four sort modes, and a direction dial on something that's usually pure chaos.

Why you'd reach for it

You want controlled glitch. Pixel sorting is the look behind a thousand album covers and music-video transitions: bright pixels dragged sideways into silky streaks, then stopping dead at a hard edge. Unlike most glitch nodes that just throw noise at your image, this one sorts deterministically - same inputs, same seed, same output - which means you can dial in a look and have it stick across frames or across a batch.

How it works

The node walks each row (or column, depending on rotation) of the image, breaks it into segments based on your threshold, and sorts the pixels inside each segment. The sort key is whatever sort_mode you pick:

  • luminance - brightness (0.2126R + 0.7152G + 0.0722B). The classic streaky look.
  • hue - sorts by color angle, giving rainbow smears.
  • saturation - pushes vivid colors apart from muted ones.
  • laplacian - sorts by edge magnitude, so streaks follow image contours.

threshold controls how the scan line is chopped into segments: lower values make more, shorter segments (finer texture, slower); higher values make fewer, longer streaks. rotation sets the sorting direction - the default of -90 sorts vertically, 0 sorts horizontally, and the 90/180 steps flip the travel direction.

The useful bit is mask. White areas get sorted, black areas keep their original pixels, so you can protect a face or a logo and let the background melt into streaks. It's a required input, so if you want to sort the whole frame just feed it an all-white mask. multi_pass runs all four modes in sequence for a much denser, more intense effect - expect it to be slower. seed exists so you can reproduce a result exactly.

The inputs that matter

The ones a beginner actually touches: images, mask, sort_mode, threshold, and rotation. Leave multi_pass off until you've got a single mode dialed in, and treat seed as a randomize-until-you-like-it button (though at 0 impressions on comfy.icu, treat this whole page as the documentation).

Output is a single IMAGE - same dimensions as the input - that feeds straight into a Save Image node or a video encoder.

Installing it

This is one node inside DJZ-Nodes, Drift Johnson's big pack of 75+ nodes. Install the pack once and you get all of them:

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

Or just search "DJZ-Nodes" in ComfyUI Manager and click install. The pack pulls in heavy deps (opencv-python, librosa, numba, moderngl) - give it a minute. No model downloads for this node; it's pure numpy/scipy math.

Troubleshooting

  • The node is missing from your menu. The pack's __init__.py silently skips any node whose import fails. If it vanished after an update, a dependency broke - reinstall requirements.txt and watch the console for "Unable to import" lines.
  • Too fast, too aggressive. Start at threshold 0.5, luminance mode, and back the threshold up before you touch anything else. Threshold below ~0.2 shreds images into confetti.
  • Slow on big batches. Multi-pass and low thresholds are the expensive combos. Keep the source resolution modest if you're sorting a whole video sequence.
Categoryimage/effects

Inputs (7)

NameTypeDefaultDescription
imagesIMAGE
maskMASK
sort_modeCOMBO4 options: luminance, hue, saturation, laplacian
thresholdFLOAT0.500–1
rotationINT-90-180–180
multi_passBOOLEANfalse
seedINT420–4294967295

Outputs (1)

NameTypeDescription
IMAGEIMAGE