Nodes/ComfyUI-DeGrid/VAE DeGrid (Nyquist Notch)
ComfyUI Node

VAE DeGrid (Nyquist Notch)

The 2px Grid on Qwen-Image / Krea 2 Output, Killed in One Node

By lunaaispace-eng·Created 2 months ago·Updated 2 months ago· 4
VAE DeGrid (Nyquist Notch)
  • image
  • image
  • removed_grid
enabledtrue
modeauto
limit0.020
grid_gain10
grid_view4x zoom

The grid you didn't know was there

Zoom to 100% on a Krea 2, Qwen-Image, Qwen-Image-Edit, or Anima render and look closely. There it is: a faint 2-pixel checkerboard laid across the whole image. It's the fingerprint of the Qwen Image VAE, which all of those models share - and the Wan 2.1 VAE leaves a weaker version of the same thing. At 100% it's easy to miss, but sharpen or upscale afterwards and it stops being subtle; those operations happily amplify a 2px pattern into ugly fabric grain. That's when most people start blaming their upscaler or model. It isn't either - it's the decode.

VAE DeGrid (Nyquist Notch) is the one-node fix, and it goes between VAE Decode and everything else. Wire it in, leave the defaults on, and the grid is gone before any sharpener can touch it.

How it works

The grid is exactly periodic, which is a weakness, not a strength. A Nyquist notch filter has an exact zero at 2px-period frequencies - vertical stripes, horizontal stripes, or a checkerboard - and passes everything else through. This implementation builds it as a separable 9-tap alternating-sign binomial kernel (a 1D response of sin⁸(ω/2)), combined as center − Bx − By + Bxy so it factors into (1 − sin⁸(ωx/2))(1 − sin⁸(ωy/2)): an 8th-order flat zero at the grid frequency, exact unity at DC, so gradients don't band.

The part worth knowing is what comes after the filter. The original community GLSL version of this idea drew real criticism - users reported it softening hair and high-contrast edges (you can find that thread on r/StableDiffusion; the pack's README credits it directly). This port fixes that with amplitude limiting: the correction is clamped before subtraction, so strong real edges and fine texture pass through unsoftened and only the low-amplitude artifact band gets removed. In auto mode it estimates the clamp per image from a robust percentile of the extracted grid, so it adapts to different VAEs and content with nothing to tune.

The inputs and outputs that matter

The node has five widgets, but you'll touch two of them, if that:

  • image - wire it straight from VAE Decode. This matters: the node only fixes what the VAE itself produced, so it must sit before any sharpening, deconvolution, or upscaling.
  • mode - auto (default) measures each image and sets its own removal limit. Drop to manual only if auto visibly under- or over-corrects.
  • limit - manual mode only, ignored in auto. Default 0.02. Too low and the grid survives in contrasty areas; too high and fine 2–3px texture (pores, fabric weave) gets slightly softened. The VAE grid usually sits at 0.005–0.02, so you'll rarely move far.
  • enabled - a genuine off switch; flip it to A/B compare without rewiring.

Two outputs: image, the degridded result (same size, send it onward to sharpen/upscale/save), and removed_grid, a visualization of what was subtracted. Both grid_gain (brightness of that preview) and grid_view (its framing) are preview-only - they never touch the cleaned image. Trap: removed_grid showing "gray noise" is success, not failure. A 2px lattice is far below what a node-preview thumbnail can render, so it aliases into uniform gray. Switch grid_view to 4x zoom or 8x zoom to see the lattice. If you can recognize faces or fabric in it, the limit is too high.

After each run the node prints a status line:

grid ≈ 2.10/255 - removed (limit 0.019 auto) · edges protected: 1.2%

That's your confirmation it worked - no pixel-peeping required. A raw Qwen-VAE grid typically measures 1–5/255; below ~0.5/255 it calls the image already clean, which is correct, not a fault.

Install

No model files, no heavy dependencies - the whole thing is pure PyTorch, so it runs headless (no OpenGL/GLFW needed, unlike the original GLSL approach). Install via ComfyUI Manager (search "DeGrid"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/lunaaispace-eng/ComfyUI-DeGrid

Restart ComfyUI and search for degrid. One real gotcha: it's built on ComfyUI's newer extension API (comfy_api), so if the node doesn't show up, update ComfyUI itself first - old installs won't load it.

Common issues

  • Grid still visible in contrasty areasmode: manual, raise limit toward 0.03–0.04.
  • Fine texture looks softened → lower limit toward 0.01.
  • Status says negligible but you still see a grid → the grid is coming from a later node - a sharpener or upscaler that regenerated it. DeGrid only fixes what VAE Decode produced, so check the chain order.
  • removed_grid looks like flat gray → raise grid_gain, or the image simply has no grid.

The status line's edges protected: N% is worth reading: a few percent is normal, and it means real edges are being passed through untouched. A very high number means lots of legit high-frequency content - or a manual limit set too low.

For what it's worth, the popular Wan 2.1 decoder swap fixes a different complaint - the Qwen decoder's over-smoothed texture - not this grid. DeGrid is the surgical fix. Most people just need the notch.

Categoryimage/postprocessing

Inputs (6)

NameTypeDefaultDescription
imageIMAGEWire straight from VAE Decode.
enabledBOOLEANtrueOff = the image passes through completely untouched. Use it to A/B compare with and without degrid.
modeCOMBOautoauto (recommended): measures the grid strength of each image and sets the removal limit itself — nothing to tune. manual: uses the 'limit' value below instead; use it only if auto visibly under- or over-corrects.
limitFLOAT0.0200–0.1MANUAL MODE ONLY (ignored in auto). Maximum per-pixel correction on the 0-1 scale. The VAE grid is usually 0.005-0.02, so 0.02 is a good start. Too low = grid partially survives in contrasty areas. Too high = fine 2-3px texture (pores, fabric) gets slightly softened.
grid_gainFLOAT101–50Brightness amplification of the removed_grid preview ONLY — it never affects the cleaned image. Raise it if the preview looks like flat gray and you want to see the removed pattern more clearly.
grid_viewCOMBO4x zoomFraming of the removed_grid preview. The artifact is only 2px, so 'full frame' aliases into gray noise at node-preview size — normal, but hard to read. '4x zoom' / '8x zoom' show a magnified center crop where the actual 2px lattice is visible. Preview only; the cleaned image is never cropped.

Outputs (2)

NameTypeDescription
imageIMAGEThe degridded image — same size as the input. Send this onward to sharpening/upscaling/save.
removed_gridIMAGEVisualization of what was subtracted (amplified by grid_gain, centered on gray). Healthy result: a uniform fine grid/noise texture. If you can recognize faces or fabric here, the limit is too high. Not meant for further processing — preview only.