Spectral Spike Suppressor
Delete the spikes your VAE hates
- image
- image
This is the flagship node of ComfyUI-Spectral-Preprocessing-Nodes - the one the README opens with, the one with the before/after demo in the repo docs, and the one you'll probably reach for first. Its job: find isolated peaks in your image's FFT magnitude spectrum and quietly attenuate them. Those peaks are the frequency-domain signature of periodic artifacts - JPEG ringing, checkerboard patterns from transposed convolutions, moiré fringes, CNN grid artifacts. They're nearly invisible in the pixels, but they're exactly the kind of contamination that makes a VAE encoder and diffusion model produce sparkle, broken texture, and instability in Flux img2img.
The demo in the repo is the best summary of what this node is about: they take a photo, inject a checkerboard artifact, and show the FFT spectrum with a bright cross-shaped spike pattern through the center. After the Spike Suppressor runs, the spike is gone from the spectrum - and the spatial image looks virtually identical. That's the whole design philosophy of the pack in one image: fix the frequency domain, keep the pixels.
How it works
The pipeline is: FFT → estimate a smooth background with a median filter → compute a z-score map using the median absolute deviation (MAD) as the robust noise scale → build a smooth sigmoid attenuation mask for coefficients flagged as spikes → reconstruct using the original phase → IFFT. Phase is never modified, so edges are preserved exactly. The sigmoid rather than a hard threshold is deliberate - the pack's design rule is "smooth, never hard," because binary masks ring.
The inputs that matter
threshold_sigma(default 3.0) - the z-score above which a coefficient counts as a spike. Lower = more aggressive. The README's tuning guide says lower it if the effect is too weak.attenuation(default 0.85) - the maximum fraction of spike energy removed (1.0 = full suppression). You don't usually need 1.0.kernel_size(default 15) - the median filter size for background estimation; must be odd. Larger captures broader structure - the README suggests raising it for broader JPEG-ringing spikes.preserve_dc(default True) - protects the DC coefficient (mean brightness). Leave it on.
Then the pack-standard tile_size / tile_overlap for images above ~2048px (0 = whole image, fine for most). One image output, wired into the next node or VAE Encode.
Installing it
Ships in ComfyUI-Spectral-Preprocessing-Nodes - one install, all sixteen nodes under Spectral Preprocessing. ComfyUI Manager (search "ComfyUI-Spectral-Preprocessing-Nodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/EdoardoGuerriero/ComfyUI-Spectral-Preprocessing-Nodes
Restart. Dependencies are numpy and scipy, both bundled with a standard ComfyUI install. No models, no API keys.
Where people get burned
The main trap is expecting a visible before/after. This node is engineered to be perceptually invisible - judge it by whether your img2img output stops sparking, not by whether the image "looks processed." If you push threshold_sigma too low, you stop removing only real spikes and start flattening legitimate sharp detail, which shows up as a subtle softening; that's when you back it off. The README's recommended stacking puts this node first in the chain - before directional suppression, noise-floor lifting, and the rest - because periodic artifacts contaminate the statistics every later node computes. Run the pack's FFT Spectrum Visualizer before and after (matching its kernel_size and threshold_sigma to yours so the gain-mask panel is honest) and you'll see the spike vanish while the image content stays put - which is exactly the deal this whole pack is selling.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold_sigma | FLOAT | 3.00.5–20 | Z-score threshold above which a frequency coefficient is considered a spike. Lower values are more aggressive. |
| attenuation | FLOAT | 0.850–1 | Maximum fraction of spike energy to remove. 1.0 = full suppression, 0.0 = no change. |
| kernel_size | INT | 153–63 | Median filter kernel size for background estimation. Must be odd; larger values capture broader structure. |
| preserve_dc | BOOLEAN | true | Protect the DC component (mean brightness) from any attenuation. Recommended: True. |
| tile_size | INT | 00–2048 | Tile size for large images. 0 = process whole image. |
| tile_overlap | INT | 640–512 | Tile overlap in pixels (used only when tile_size > 0). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |