GlitchIT | GlitchNodes
Byte-level JPEG corruption, the real deal
- images
- image
GlitchIT is the most honest glitch node in the pack, because it actually does the thing the others only imitate. It encodes your image to a real JPEG in memory, flips random bytes inside the scan data, decodes the damaged file, and hands you back whatever survived. No synthesized artifacts, no fake compression - the corruption is real, and the result has that authentic "file got mangled on a floppy disk" energy that no shader can fake.
The mechanism is textbook data corruption, and it's delightfully crude. The source encodes the tensor to JPEG (quality 95), finds the Start Of Scan (0xFFDA) and End Of Image (0xFFD9) markers, and then corrupts a random selection of bytes in between - carefully skipping any 0x00 or 0xFF bytes because those are JPEG structure bytes and nuking them produces a decode error instead of a glitch. Corrupted bytes are changed to a random 1–254 value. Then it reopens the mangled JPEG. That's it. The result depends entirely on which bytes got hit - sometimes you get subtle macroblocking, sometimes glorious moiré streaks, sometimes it just looks a bit soft.
The inputs that matter
- min_amount / max_amount (0–100 each, defaults 1 and 10) - how many bytes to corrupt per image. The spread between them is your unpredictability knob; narrow it for consistency, widen it for chaos. (If min > max, the node swaps them, so you can't break it that way.)
- seed - required, and this is the node where seed matters most. GlitchIT's whole personality is seeded: the same seed picks the same bytes, so when you land on a perfect streak, you can actually reproduce it - including on later frames of a batch.
Output is image (IMAGE) → PreviewImage/SaveImage. It processes each frame of a batch independently (seed + frame index), which is great for video: every frame gets its own fresh corruption. If the input has an alpha channel, it's preserved.
Installing it
It's in the GlitchNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/pxl-pshr/GlitchNodes
# restart ComfyUI
or ComfyUI Manager → Install Custom Nodes → search "GlitchNodes". Dependencies are numpy, torch, Pillow, opencv-python, scipy - Pillow does the JPEG encode/decode, so nothing exotic is needed. No model files.
Gotchas
Two real-world gotchas. First, results are binary: at max_amount 10 the effect is often barely visible, and at 50+ it can look like the image was run over by a truck. The sweet spot for "subtle but present" is small amounts and a few frames. Second, a badly corrupted byte can still trip Pillow's decoder on some images - the node clamps and recovers most of the time, but the pack's standing warning is "highly experimental and may break or even error," and a stubborn file can error out. Lower the max_amount and retry. Worth it, though - this is the one node that produces glitches you literally cannot fake with a filter.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| seed | INT | 00–18446744073709550000 | — |
| min_amount | INT | 10–100 | — |
| max_amount | INT | 101–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |