Video Bit Clamp
Quantize video to a handful of levels, with proper dithering
- images
- IMAGE
Video Bit Clamp is a deliberate-damage node: it quantizes image or video down to a small number of tonal levels so you get visible banding and posterization - then optionally fixes that banding with real dithering. It's the "bit-depth manipulation" entry in DJZ's video processing lineup, and it does double duty: retro/glitch aesthetics on one hand, and a legit dithering utility on the other.
Here's the thing the labels lie about
The bit_depth dropdown says 8bit, 16bit, 32bit, 64bit, 128bit - but look at the code and those are not bits per channel. The mapping is:
8bit→ 2 bits/channel → 8 levels16bit→ 3 bits/channel → 16 levels32bit→ 4 bits/channel → 32 levels64bit→ 5 bits/channel → 64 levels128bit→ 6 bits/channel → 128 levels
So "8bit" is the most destructive option (8 levels per channel - your image becomes a poster), and "128bit" is the gentlest at a still-bandable 128 levels. The labels are effectively counting the output levels, not the bit depth. Keep that in mind and the defaults make sense: 8bit is the aggressive retro look, 128bit is where you go when you want subtle banding or are actually trying to remove banding.
How it works
For each frame, the node:
- Optionally converts to YUV (
color_space) so quantization happens in a luminance-oriented space rather than RGB. - Applies a gamma curve (
gamma, default 2.2) so the quantization lands perceptually rather than on raw values. - Quantizes to the level count - with no dithering (harsh bands), ordered dithering (a Bayer-pattern grid that breaks up bands into texture), or Floyd-Steinberg (error diffusion, the classic image-magick approach that keeps smooth gradients while still limiting colors).
- Optionally applies noise reduction and a
temporal_coherencepass to stop the dither pattern from crawling between frames.
The Floyd-Steinberg + temporal coherence combo is the genuinely useful path: you can crush a 4K frame into 16 levels without ugly banding, which is a real technique for stylized video.
Inputs and outputs
Required: images, bit_depth, dithering (none/ordered/floyd-steinberg), color_space (RGB/YUV), preservation (0–1, blend back toward the original). Optional: gamma, noise_reduction, temporal_coherence.
Output: IMAGE, same dimensions, batch-safe.
Where you'd use it
Two lives. Retro/glitch: 8bit + ordered dither + a bit of preservation for that "crushed VGA game" look, alongside the pack's VGA Effect. Stylized video: higher level counts + Floyd-Steinberg + temporal coherence to force a deliberate low-color palette that stays stable frame to frame - the temporal pass is the difference between "stylized" and "flickering mess."
Install
Part of DJZ-Nodes by Drift Johnson. ComfyUI Manager → "DJZ-Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Restart ComfyUI. Pure torch/numpy - already in ComfyUI.
Gotchas
Remember the label trick above - start at 32bit/64bit if you want a mild effect, not 8bit, unless you truly want a poster. Floyd-Steinberg is noticeably slower than ordered dithering on long clips. And temporal_coherence defaults to 0, so if you're doing video, turn it up or the dither texture will visibly swim between frames.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| bit_depth | COMBO | 8bit | 5 options: 8bit, 16bit, 32bit, 64bit, 128bit |
| dithering | COMBO | none | 3 options: none, ordered, floyd-steinberg |
| color_space | COMBO | RGB | 2 options: RGB, YUV |
| preservation | FLOAT | 0.000–1 | — |
| gammaopt | FLOAT | 2.21–3 | — |
| noise_reductionopt | FLOAT | 0.00–1 | — |
| temporal_coherenceopt | FLOAT | 0.00–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |