Nodes/DJZ-Nodes/Video Bit Clamp
ComfyUI Node

Video Bit Clamp

Quantize video to a handful of levels, with proper dithering

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Video Bit Clamp
  • images
  • IMAGE
bit_depth8bit
ditheringnone
color_spaceRGB
preservation0.00
gamma2.2
noise_reduction0.0
temporal_coherence0.0

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 levels
  • 16bit → 3 bits/channel → 16 levels
  • 32bit → 4 bits/channel → 32 levels
  • 64bit → 5 bits/channel → 64 levels
  • 128bit → 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:

  1. Optionally converts to YUV (color_space) so quantization happens in a luminance-oriented space rather than RGB.
  2. Applies a gamma curve (gamma, default 2.2) so the quantization lands perceptually rather than on raw values.
  3. 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).
  4. Optionally applies noise reduction and a temporal_coherence pass 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.

Categoryimage/effects

Inputs (8)

NameTypeDefaultDescription
imagesIMAGE
bit_depthCOMBO8bit5 options: 8bit, 16bit, 32bit, 64bit, 128bit
ditheringCOMBOnone3 options: none, ordered, floyd-steinberg
color_spaceCOMBORGB2 options: RGB, YUV
preservationFLOAT0.000–1
gammaoptFLOAT2.21–3
noise_reductionoptFLOAT0.00–1
temporal_coherenceoptFLOAT0.00–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE