Nodes/ComfyUI_LG_FFT/🎈LG_IFFT
ComfyUI Node

🎈LG_IFFT

LG_IFFT, the filter half of the FFT pair

By LAOGOU-666·Created 2 years ago·Updated 2 years ago· 8
🎈LG_IFFT
  • ff
  • mask
  • image
filter_typelow_pass
low_cutoff10
high_cutoff50
invert_maskfalse

This is the node that actually does the work. 🎈LG_FFT converts your image to frequency space; 🎈LG_IFFT filters that spectrum and converts it back. Together they're a classical image-processing chain that lives inside ComfyUI - no model, no prompt, no risk of an AI "restorer" quietly redrawing your face while it cleans up your scan. The pack's README is blunt about the main event: low-pass filtering to kill the moiré web patterns (网纹) you get from scanning printed material.

How it works

The mechanism is honest signal processing. The node takes the complex frequency data from LG_FFT, builds a filter as a radial distance from the center of the spectrum plane, and - here's the interesting bit - multiplies that filter by the mask you feed in (combined_mask = l_mask * filter_mask). Then it applies the result to the spectrum, runs ifftshift + ifft2, takes the magnitude, and returns an IMAGE.

Three filter shapes, all straightforward:

  • low_pass - keeps everything below a radius. Kills high-frequency noise, scan texture, and moiré. This is the one you'll use 90% of the time. Note the quirk: the cutoff knob for low-pass is high_cutoff.
  • high_pass - keeps everything above a radius; the knob is low_cutoff. Good for edge/sharpening tricks, less useful for cleanup.
  • band_pass - keeps a band between low_cutoff and high_cutoff, both active. For the "particular uses" the author mentions but leaves mostly to you.

This naming split is intentional and documented - low-pass only touches high_cutoff, high-pass only touches low_cutoff. It trips people up once, then never again.

The inputs that matter

  • ff - the FFTData output from 🎈LG_FFT. The custom type, not the spectrum picture. This is the number one wiring mistake.
  • mask (MASK) - a mask you draw or generate, multiplied against the filter to restrict where it bites. Draw it with the MaskEditor directly on your image.
  • filter_type - low_pass / high_pass / band_pass, default low_pass.
  • low_cutoff and high_cutoff - INT, 0–1000, defaults 10 and 50. These are radii in pixels in the frequency plane, so on a typical megapixel image you're living in the low double digits.
  • invert_mask - flips your mask (1 - mask). One of the author's additions over the original fssorc FFT pack, handy when you want to protect a region from filtering instead of filtering it.

The single output is image - the reconstructed result. Wire it to PreviewImage, SaveImage, or anything downstream.

Install

Same pack as LG_FFT, so if you already installed it you're done. Otherwise: ComfyUI Manager → search ComfyUI_LG_FFT, or:

cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/ComfyUI_LG_FFT

Restart ComfyUI; both nodes land in 🎈LAOGOU. No models to download, dependencies are just torch/torchvision/numpy (already in ComfyUI - cv2 is imported but not declared, and ComfyUI bundles it anyway).

Common issues

  • Mask size mismatch. The mask is multiplied pointwise against the spectrum, so it must match the input image's dimensions. Draw it with the MaskEditor on the actual image and you're safe; a mask from a differently-sized LoadImage will blow up the multiply or silently do nothing useful.
  • Wrong ff input. Feed the FFTData output, not the spectrum image, or the node won't even attach.
  • Over-filtering = blur. A low-pass that's too aggressive (high cutoff set very low) turns everything to jelly. Start around high_cutoff 20–60 for moiré and nudge down until the pattern dies but edges survive. Mild blur is the built-in cost of low-pass - that's physics, not a bug.
  • It won't invent missing detail. If the whole image is damaged, this isn't the tool - that's the SUPIR/SeedVR2 territory covered elsewhere in the restoration ladder. FFT filtering removes periodic junk while preserving everything else, which is exactly why it's the right call for scan moiré.

A r/comfyui user asked in 2026 whether traditional moiré elimination in ComfyUI was even feasible, and the answers steered straight to AI upscalers. This pair is the answer to the "but I don't want the AI to touch my image" version of that question.

Category🎈LAOGOU

Inputs (6)

NameTypeDefaultDescription
ffFFTData
maskMASK
filter_typeCOMBOlow_pass3 options: low_pass, high_pass, band_pass
low_cutoffINT100–1000
high_cutoffINT500–1000
invert_maskBOOLEANfalse

Outputs (1)

NameTypeDescription
imageIMAGE