Nodes/Eric_Krea2/Eric Krea2 DeGrid (VAE grid remover)
ComfyUI Node

Eric Krea2 DeGrid (VAE grid remover)

Remove the 2-pixel lattice before you sharpen it into fabric

By EricRollei·Created 4 months ago·Updated a day ago· 21
Eric Krea2 DeGrid (VAE grid remover)
  • image
  • image
  • removed_grid
  • report
◄enabledtrue►
◄modeauto►
◄limit0.020►
◄skip_when_cleantrue►
◄grid_gain10►

Here's an annoyance you may have blamed on your sampler. Krea 2 uses the Qwen-Image VAE - 16-channel, f8, shared with Qwen-Image and Wan 2.1 - and that VAE leaves a faint fixed-phase 2-pixel grid in decoded images. It's worst in flat and dark areas, where there's nothing to hide it. Then the spacepxl 2× upscale VAE builds its output with a pixel_shuffle(2), which is also a 2×2 cell structure. Do an inter-stage VAE hop - decode, upscale, re-encode - and you've just fed that lattice into the next stage, which treats it as texture and develops it into something that looks like faint weave or screen-door lines.

Eric Krea2 DeGrid is a small, sharp tool for exactly that: a 2-pixel notch filter you drop straight after a decode, before anything that would amplify the lattice.

How it works

The filter core is ported from lunaaispace-eng/ComfyUI-DeGrid (Apache-2.0) and adapted to the pack's tensors. It's a separable 9-tap alternating binomial kernel - [1, -8, 28, -56, 70, -56, 28, -8, 1]/256 - whose frequency response is sin^8(w/2). That's the nice part: it's an exact zero at any 2-pixel-period pattern, whether that's a checkerboard or stripes, and unity at DC with an 8th-order flat zero, so you don't get banding in the passband. Two passes (horizontal, vertical, minus the cross term) give the grid component; everything else cancels.

Then comes the part that makes it usable rather than destructive. Detection is statistical: the code averages the four (y%2, x%2) sublattices over the whole image. Incoherent real detail averages away across millions of pixels; a phase-locked lattice doesn't. That measured amplitude sets the clamp, and the correction is amplitude-limited, so real edges pass through untouched. If the measured amplitude is below 0.5/255 the raw grid floor, the image is considered clean and passed through unmodified.

Inputs and outputs

image in, and that's the only required one. The knobs:

  • mode - auto (default) calibrates the clamp limit per image, which is what you want. manual hands the correction over to limit (default 0.02, in 0–1 units, larger = stronger and more real fine texture eaten).
  • skip_when_clean - leave this on. Off, it shaves roughly 1/255 of genuine fine texture off images that had no grid in the first place.
  • enabled - pass-through. Free A/B, no rewiring.
  • grid_gain - amplification for the diagnostic output only.

Outputs are three: image (the corrected image), removed_grid (what got subtracted, ×grid_gain, offset to mid-grey so you can actually see it) and report, a string with the measured amplitudes. Feed removed_grid to a Preview Image and report to a Show Text node. If removed_grid shows you actual picture content instead of a regular comb, your limit is too high.

The same logic is wired into the pack's decode nodes as a degrid toggle, and the Ultra node takes degrid with hops / final / hops+final - hops cleans the inter-stage VAE upscale before re-encoding (no effect on plain latent hops, which have no pixel step), final cleans the decoded output. The standalone node is there for images that came from anywhere else.

Installing it

Nothing special: it's part of the pack and has no extra dependencies beyond the pack's own.

cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Krea2_ComfyUI_Advanced

Or search Eric_Krea2 in ComfyUI Manager. You do still need a diffusers build with Krea2Pipeline for the other nodes in the pack, but DeGrid itself is pure torch convolution - it will happily de-grid an image from any model, including one you made a month ago in something else.

Practical notes

Put it immediately after the decode and before sharpening, resizing or any detail restorer. Sharpening an aliased 2-pixel lattice is how a mild grid becomes a visible screen-door texture; resizing can alias it into a new pattern entirely.

Strength-wise, auto is right more often than not. The failure mode of manual is subtle - you don't get a broken image, you get an image that looks very slightly plasticky because you filtered real micro-texture along with the grid. If a portrait's skin or a landscape's foliage looks "off" after a DeGrid pass, halve limit and compare crops at 1:1. And if the report tells you the amplitude was negligible, believe it and move on.

CategoryEric/Krea2

Inputs (6)

NameTypeDefaultDescription
imageIMAGE—
enabledoptBOOLEANtrueOFF = pass through untouched (quick A/B).
modeoptCOMBOautoauto: per-image calibrated clamp limit. manual: use 'limit'.
limitoptFLOAT0.0200.001–0.2manual mode: max correction per pixel (0..1 units); larger = stronger, but more real fine texture removed.
skip_when_cleanoptBOOLEANtrueLeave an image untouched when no phase-locked lattice is detected (otherwise ~1/255 of real fine texture is shaved).
grid_gainoptFLOAT101–100Amplification of the removed-grid preview output.

Outputs (3)

NameTypeDescription
imageIMAGE—
removed_gridIMAGE—
reportSTRING—