Comfyui-LatentUtils
a set of utils for comfyui latent operation
Package profile
- Status
- Verified
- Publisher
- @lrzjason
- Source
- GitHub
README
Latent Utils for ComfyUI
Effect Preview
Example output showing original (left) and enhanced image (right)
high_freq_mult: 2 is an extreme value to show the difference (demo only).
Node Preview
🌟 Overview
This custom ComfyUI node performs selective latent denoising and detail enhancement using Fourier Transform (FFT) techniques. It intelligently separates image frequencies to:
- Preserve and enhance important high-frequency details
- Suppress background noise and artifacts
- Output a visual preview of the processing mask
Ideal for refining AI-generated images while maintaining sharp features and eliminating graininess.
Supports models:
- Wan vae (Qwen, etc)
- Flux vae (ZImageTurbo, Flux1.dev, etc)
- Other models not tested
⚙️ Installation
- Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes - Clone this repository:
git clone https://github.com/lrzjason/comfyui-latent-frequency-enhancer.git - Restart ComfyUI
- Find the nodes under:
latent → enhancement → Latent Frequency Enhancer (lrzjason)sampling → HFEPostProcessor (lrzjason)
🔬 How It Works
-
Frequency Separation Uses FFT to split latent into:
- Low frequencies: Base composition and smooth areas
- High frequencies: Details, textures, and noise
-
Smart Mask Generation Creates a dynamic mask using:
- Sigmoid soft-gating function
- Adjustable noise threshold
- Pre-blur for noise coherence
-
Selective Enhancement
- Boosts important high-frequency details
- Suppresses noise below threshold
- Smoothly blends components using frequency-aware masking
-
Visual Feedback Outputs a mask preview showing:
- White areas: Preserved/enhanced details
- Black areas: Suppressed noise
- Gray transitions: Smooth blending zones
🚀 HFEPostProcessor: In-Process Enhancement
The HFEPostProcessor node applies high-frequency enhancement during the sampling process rather than after it. This approach:
- Applies enhancement at specific sampling steps (after basic sampling)
- Integrates frequency enhancement directly into the generation pipeline
- Allows for more refined control by specifying which steps to enhance
- Works as a sampler replacement that combines sampling with enhancement
Qwen Preview
🎚️ Parameters Explained
Latent Frequency Enhancer Node
| Parameter | Default | Range | Description |
|---|---|---|---|
| Detail Strength (HF Mult) | 1.15 | 1.0-2.0 | Multiplier for high-frequency details (values >1 enhance details) |
| Frequency Split Sigma | 2.0 | 0.1-20.0 | Controls frequency separation sharpness (higher = more low frequencies preserved) |
| Noise Threshold | 0.05 | 0.0-1.0 | Minimum magnitude to preserve details (higher = more aggressive denoising) |
| Mask Hardness | 2.0 | 1.0-100.0 | Transition sharpness in noise suppression (higher = sharper cutoff) |
| Noise Grouping (Pre-Blur) | 0.5 | 0.0-1.0 | Pre-blur strength for noise coherence (0.0 disables) |
HFEPostProcessor Node
| Parameter | Default | Range | Description |
|---|---|---|---|
| Model | - | - | The diffusion model to use for sampling |
| Steps | 8 | 1-10000 | Total number of sampled steps |
| HFE Steps | 2 | 1-100 | Number of steps to apply high-frequency enhancement |
| Latent Image | - | - | The latent image to enhance |
| Noise Seed | 0 | 0-18446744073709551615 | Random seed for noise generation |
| CFG Scale | 1.0 | 0.0-100.0 | Classifier-free guidance scale |
| Sampler Name | - | Various | Name of the sampler to use |
| Scheduler | - | Various | Scheduler to use for sampling |
| Positive | - | - | Positive conditioning |
| Negative | - | - | Negative conditioning |
| Detail Strength (HF Mult) | 1.05 | 1.0-2.0 | Multiplier for high-frequ |
Nodes in this pack
2 nodes
Nodes in this pack
2 nodes- HFEPostProcessor (lrzjason)
- LatentFrequencyEnhancer_lrzjason
Sources
3 sources
Sources
3 sourcesVerified Oct 25
Verified Oct 25
Source excerpts
1 excerpt
Source excerpts
1 excerptSource context: Repo lrzjason/Comfyui-LatentUtils
