Frequency Separate (MEC)
Split an image so you can keep the texture and throw away the lighting
- image
- mask
- high_frequency
- low_frequency
- high_frequency_masked
- report
Why you'd want this
Relight a product shot with IC-Light, or an image with any of the editing models, and the model gives you new lighting and quietly resamples every pore, fibre and speck of dust in the process. The classic retouching answer to "I want the new lighting but the original texture" is frequency separation: split the image into a soft base (the light, the colour, the big shapes) and a fine detail layer (skin texture, fabric weave, the grain of a surface), throw away the base, and graft the original detail on top of the new lighting.
This has been standard Photoshop retouching for a decade and it landed in ComfyUI properly around 2024 - the workflow that made it popular was a product-relight pipeline that merged the high-frequency layer of the original with the relit version, masked to the area you cared about, and the author's framing was exactly right: before this you had to do a double frequency-separation pass in Photoshop and merge the two HF layers by hand.
Frequency Separate (MEC) is the port of that idea into this pack - and notably, a port of Nekodificador's ComfyUI-NKD-Basic-Tools implementation rather than a from-scratch reimplementation, which matters when you're debugging behaviour that looks familiar from elsewhere.
How it works, and the one thing to understand
The split is done in working space, not display space, and that's the design decision the whole node is built around.
When linear is on (the default), Separate converts to linear light, computes the base and the detail there, and then:
- high_frequency leaves in working space as a raw ratio (Divide) or difference (Subtract). It may exceed 0–1. It is an intermediate, not a picture.
- low_frequency leaves in display space, so it previews correctly and matches a typical relit plate.
That asymmetry is deliberate and it's why the docstring tells you to wire them the way you do: run the LF through your relighter, feed the HF into Combine, and Combine re-linearises the LF input before recombining. mode and linear must match between Separate and Combine. Mismatch them and you get a plausible-looking but wrong result, which is the worst kind of wrong.
method chooses how the base is smoothed:
- Guided (default) - edge-preserving, so you get a clean split without the halo a Gaussian leaves at hard edges.
- Gaussian - the classic, and the one that haloes.
- Rolling Guidance - erases texture by feature size while keeping shapes, which is the one you want if your goal is "remove all the texture" rather than "separate it".
- Median - for spot blemishes. The effective radius is capped at 7 internally, and the report tells you what actually ran.
radius is the detail scale: bigger means a coarser base, so more ends up in the detail layer. edge_threshold controls how hard edges are protected in the Guided and Rolling Guidance methods - lower keeps sharper edges. detail at Luminance (default) keeps the detail achromatic so a Divide recombine can't shift colour; RGB carries chromatic detail as well, which is what you want when the texture itself is coloured.
Inputs and outputs
Required: image, method, radius, edge_threshold, mode, detail, linear. Optional: mask, which attenuates the detail layer outside the mask on the third output.
Outputs: high_frequency, low_frequency, high_frequency_masked, and a report string. The masked variant exists so you can graft detail onto only part of a plate without a separate composite node - you connect the mask, take high_frequency_masked, and you're done.
Practical notes
Don't judge high_frequency by its preview. A Divide HF layer sits around mid-grey and looks like a flat noise field; that's what a ratio map should look like. Judge the result at the end of the pair, on Frequency Combine (MEC)'s output.
For the relight workflow: Frequency Separate on the original → low_frequency into IC-Light (or your relighter) → high_frequency_masked + the relit image into Frequency Combine. That's the whole pattern.
Install
ComfyUI Manager → search "CustomNodePacks", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks
Restart ComfyUI. This node needs opencv-python (it's the filter backend for some methods) but nothing else special - no models, no downloads, tier 1, VRAM only insofar as the filters run on GPU. The pack's README asks you to check pip list before installing its requirements, and that's worth doing here more than usual, given how much of the pack wants the same libraries.
Common issues
- The recombine looks washed out or has halos.
modeorlineardoesn't match between Separate and Combine. This is the single most common mistake with these two nodes. - Halo around hard edges. You used Gaussian. Switch to Guided - avoiding exactly that halo is what the method exists for.
- Nothing looks different.
radiustoo small relative to your image, so nearly everything is "base". On a 4K frame, radius 8 puts a lot in the high-frequency layer; scale radius to the frame, not to a fixed number you liked once. - Median mode ignores my radius. Documented behaviour: it caps at 7 and says so in the report.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Split into a soft base (low frequency) and a fine detail layer (high frequency). Pair with Frequency Combine to transfer texture. | |
| method | COMBO | Guided | How the base is smoothed. Guided keeps edges clean without the halo Gaussian leaves; Rolling Guidance erases texture by size while keeping shapes; Median is for spot blemishes (radius capped internally). |
| radius | INT | 81–128 | Detail scale. Larger = coarser base, more goes into the detail layer. Median mode caps the effective radius at 7 — see the report for what ran. |
| edge_threshold | FLOAT | 0.100–1 | How strongly edges are protected (Guided / Rolling Guidance). Lower = sharper edges kept. |
| mode | COMBO | Divide | How detail is encoded. Divide (ratio) is lighting-invariant — best for transferring detail between differently-lit images. Negative ratios are discarded on Combine before recombine. |
| detail | COMBO | Luminance | Luminance keeps detail achromatic so a Divide recombine never touches color. RGB carries chromatic detail too. |
| linear | BOOLEAN | true | Process in linear light (correct). Turn off to work in gamma like classic Photoshop. Must match between Separate and Combine. |
| maskopt | MASK | Optional — attenuate the detail layer outside the mask on high_frequency_masked. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| high_frequency | IMAGE | — |
| low_frequency | IMAGE | — |
| high_frequency_masked | IMAGE | — |
| report | STRING | — |