A comprehensive collection of advanced image processing nodes for ComfyUI, featuring state-of-the-art denoising, enhancement, and restoration techniques with GPU acceleration and specialized film grain processing.
- Automatic Grain Analysis: Intelligent detection of authentic film grain, digital noise, and simulated overlays
- Specialized Processing: Tailored denoising strategies for each grain type
- GPU Acceleration: CUDA-accelerated wavelet transforms for high-performance processing
- Preservation Controls: Fine-tuned grain preservation from 0% to 100%
- Multi-stage Processing: Advanced processing pipelines for optimal results
- GPU Wavelet Denoising: Hardware-accelerated wavelet transforms with CuPy
- BayesShrink, VisuShrink, SureShrink adaptive thresholding
- Multiple wavelet families (Daubechies, Biorthogonal, Coiflets, etc.)
- Regular and stationary (translation-invariant) wavelet transforms
- Automatic CPU fallback for compatibility
- Non-Local Means: Texture-preserving denoising for natural images
- Adaptive Enhancement: Intelligent image analysis with automatic parameter optimization
- Homomorphic Filtering: Illumination and reflectance separation
- Phase-Preserving Enhancement: Frequency domain enhancement with natural results
- Multi-scale FFT Enhancement: Pyramidal frequency processing
- Adaptive Frequency Filtering: Content-aware frequency domain operations
- Richardson-Lucy Deconvolution: Advanced iterative deconvolution
- Wiener Filtering: Optimal noise-to-signal ratio restoration
- Point Spread Function (PSF) Modeling: Gaussian, motion, and custom PSF support
- GPU Memory Management: Intelligent memory usage with automatic cleanup
- Batch Processing: Efficient processing of multiple images
- Adaptive Parameter Selection: Automatic parameter optimization per image
- Memory Management: Optimized for large images and batch processing
- Progress Tracking: Real-time processing feedback
- Comprehensive Error Handling: Robust operation with fallback mechanisms
-
Clone or download this repository to your ComfyUI custom nodes directory:
ComfyUI/custom_nodes/Eric_Image_Processing_Nodes/ -
Install dependencies using your ComfyUI Python environment:
# Navigate to the node directory cd ComfyUI/custom_nodes/Eric_Image_Processing_Nodes # Install requirements pip install -r requirements.txt
-
Optional: Install CuPy for GPU acceleration:
# For CUDA 11.x pip install cupy-cuda11x # For CUDA 12.x pip install cupy-cuda12x
-
Restart ComfyUI to load the new nodes
-
Model Weights: Most pretrained models download automatically on first use. See Model Weights Guide for details on:
- Which models auto-download vs. need manual setup
- Where to obtain pretrained weights
- Storage requirements (~200 MB minimum, 1-2 GB recommended)
- License information for each model
- Troubleshooting download issues
- DeepInv Service Setup & Usage Guide – Run the FastAPI helper service and explore presets for the
DeepInv Denoise (Eric)node.
Advanced Film Grain Processing (Eric)- Comprehensive grain analysis and specialized denoisingGPU Wavelet Denoising (Eric)- Hardware-accelerated wavelet transforms with CuPyFilm Grain Analysis (Eric)- Diagnostic tool for grain type detection and analysis
Wavelet Denoise (Eric)- Advanced wavelet denoising with multiple methodsStationary Wavelet Denoise (Eric)- Translation-invariant wavelet denoisingNon-Local Means Denoise (Eric)- Texture-preserving denoisingAdaptive Image Enhancement (Eric)- Intelligent enhancement with content analysisDeepInv Denoise (Eric)- DiffUNet, RAM, SwinIR, and classical denoisers served by the external DeepInv service
Note: When recommendations mention "adaptive" denoising, this refers to the Adaptive Image Enhancement (Eric) node, which automatically analyzes your image and applies appropriate denoising techniques.
Homomorphic Filter (Eric)- Illumination correction and enhancementPhase Preserving Enhancement (Eric)- Natural frequency domain enhancementMultiscale FFT Enhancement (Eric)- Multi-resolution frequency processingAdaptive Frequency Filter (Eric)- Content-aware frequency filtering
Richardson-Lucy Deconvolution (Eric)- Advanced deconvolution for blur removalWiener Filter Restoration (Eric)- Optimal signal restoration
Batch Image Processing (Eric)- Efficient batch processing with consistent parameters
- Load your noisy image
- Add
Wavelet Denoise (Eric)node - Connect image input
- Adjust parameters:
- Wavelet Type:
db8for natural images,haarfor simple images - Method:
BayesShrinkfor adaptive thresholding - Sigma: Leave at 0 for auto-estimation
- Wavelet Type:
- Process and view results
- Load image with uneven lighting
- Add
Homomorphic Filter (Eric)node - Adjust parameters:
- d0: 30-60 for moderate correction
- gamma_h: 1.5-2.5 for detail enhancement
- gamma_l: 0.5-0.8 for illumination suppression
- Process to see improved lighting
- Load multiple images as a batch
- Add
Batch Image Processing (Eric)node - Select processing method (e.g.,
wavelet_denoise) - Configure parameters
- Enable
show_progressto monitor processing - Process entire batch efficiently
- Load any image
- Add
Adaptive Image Enhancement (Eric)node - Set
auto_detect_typeto True - Choose enhancement level (conservative/moderate/aggressive)
- Enable
show_analysisto see content analysis - Process for intelligent enhancement
-
Start the external DeepInv service (see guide):
python -m external_tools.deepinv_service.service -
Launch ComfyUI and add
DeepInv Denoise (Eric). -
Pick a preset (DiffUNet, RAM, SwinIR, DRUNet, DnCNN, SCUNet).
-
Set
sigma(0.0-0.5) for DiffUNet/RAM or leave at default for fixed-noise models. -
Toggle
prefer_gpuif CUDA resources are available. -
Optionally target a remote instance by setting
service_url.
-
Automatic Processing:
- Load image with grain/noise
- Add
Advanced Film Grain Processing (Eric)node - Set
processing_modeto "auto_analyze" - Adjust
preservation_level(0.0-1.0) - Enable
use_gpufor faster processing - Process to get automatically optimized results
-
Manual Processing for Specific Grain Types:
- Set
processing_modeto "manual_specify" - Choose appropriate
grain_type:- Authentic Film: For real film grain (use preservation 0.7-0.9)
- Digital Noise: For high-ISO camera noise (use preservation 0.2-0.5)
- Simulated Overlay: For artificial grain effects (use preservation 0.0-0.3)
- Select
denoising_method(gpu_wavelet recommended) - Enable
multi_stage_processingfor best results
- Set
-
GPU-Accelerated Wavelet Only:
- Add
GPU Wavelet Denoising (Eric)node - Set
use_gputo True - Choose
wavelet_typeandthresholding_method - Enable
use_stationaryfor translation-invariant processing
- Add
-
Grain Analysis Only:
- Add
Film Grain Analysis (Eric)node - Enable
detailed_analysisfor comprehensive metrics - Review grain type detection and recommendations
- Add
- Recommended Settings:
- Grain Type:
authentic_film - Preservation Level:
0.7-0.9 - Wavelet:
db8(Daubechies 8) - Method:
BayesShrink - Multi-stage:
True - Grain Enhancement:
True
- Grain Type:
- Why: Film grain has natural structure that adds character. BayesShrink preserves this while removing noise.
- Recommended Settings:
- Grain Type:
digital_noise - Preservation Level:
0.2-0.5 - Denoising Method:
adaptive - Wavelet:
db4orbior2.2 - Method:
SureShrink - Edge Preservation:
True
- Grain Type:
- Why: Digital noise is more uniform and less desirable. Aggressive removal with edge preservation maintains image quality.
- Recommended Settings:
- Grain Type:
simulated_overlay - Preservation Level:
0.0-0.3 - Denoising Method:
gpu_wavelet - Wavelet:
bior2.2 - Method:
VisuShrink - Multi-stage:
True
- Grain Type:
- Why: Artificial overlays can be completely removed while preserving the underlying image texture.
- Recommended Settings:
- Processing Mode:
auto_analyze - Preservation Level:
0.5-0.7 - Denoising Method:
adaptive - Multi-stage:
True
- Processing Mode:
- Why: Automatic analysis determines the best approach for complex grain combinations.
-
Wavelet Types:
db8: Best all-around choice for natural imagesdb4: Faster, good for general usebior2.2: Excellent for preserving edgeshaar: Fastest, good for simple images
-
Thresholding Methods:
BayesShrink: Adaptive, optimal for most imagesVisuShrink: Conservative, preserves more detailSureShrink: Hybrid approach using statistical estimationmanual: Use custom sigma value
-
Sigma Parameter (Manual Mode):
0.1-2.0: Ultra-light noise for high-quality images2.0-10.0: Light noise10.0-25.0: Moderate noise25.0-50.0: Heavy noise50.0+: Extreme noise
- h Parameter: Filtering strength (auto-estimated if 0)
0.1-1.0: Ultra-light denoising for high-quality images1.0-5.0: Subtle denoising, preserve fine details5.0-15.0: Balanced denoising (recommended)15.0-30.0: Strong denoising30.0+: Very strong, may blur details
- Patch Size: 5-7 for fine textures, 7-11 for coarse textures
- Search Window: 11-15 standard, 17-50 for maximum quality
- Blur Size:
0.1-0.5: Ultra-fine corrections for high-res images0.5-1.5: Light defocus, subtle sharpening1.5-4.0: Moderate blur (recommended)4.0+: Heavy blur
- Motion Length:
0.5-2.0: Micro-motion correction for high-res images2.0-10.0: Light motion blur10.0-30.0: Moderate motion (recommended)30.0+: Heavy motion blur
- Regularization:
0.0005-0.005: Ultra-light smoothing for high-quality images0.005-0.02: Light smoothing (recommended)0.02+: Moderate to heavy smoothing
- Blur Size:
0.1-0.5: Ultra-fine sharpening for high-res images0.5-2.0: Light blur correction2.0-6.0: Moderate blur (recommended)6.0+: Heavy blur
- K Value (Regularization):
0.0001-0.001: Ultra-clean images, maximum sharpening0.001-0.01: Clean images, sharp results0.01-0.1: Moderate noise (recommended)0.1+: Noisy images, smooth results
- d0: Cutoff frequency (1-200)
1.0-10.0: Very strong illumination correction10.0-30.0: Strong illumination correction30.0-60.0: Moderate correction (recommended)60.0+: Subtle correction
- gamma_h: High frequency gain (0.1-10.0)
0.1-0.8: Reduce high frequencies (smoothing)0.8-1.2: Subtle detail enhancement1.2-2.5: Enhance details (recommended)2.5+: Strong to extreme detail enhancement
- gamma_l: Low frequency gain (0.01-2.0)
0.01-0.3: Very strong illumination suppression0.3-0.8: Moderate suppression (recommended)0.8-1.0: Gentle suppression1.0+: Boost low frequencies
- Processing Mode:
auto_analyze: Automatic grain detection and processingmanual_specify: Manual grain type selection
- Preservation Level: How much grain to preserve
0.0-0.3: Aggressive denoising (remove most/all grain)0.3-0.7: Moderate denoising (balanced approach)0.7-1.0: Conservative denoising (preserve grain character)
- Denoising Method:
gpu_wavelet: GPU-accelerated wavelet (recommended for large images)gpu_stationary_wavelet: Translation-invariant processingadaptive: Grain-specific processing pipeline
- Wavelet Selection for Grain Types:
db8: Best for authentic film graindb4: Good all-around choice, faster processingbior2.2: Excellent for edge preservation (digital noise)coif2: Good reconstruction properties
- GPU Settings:
use_gpu: Enable CUDA acceleration (requires CuPy)- Auto-enables for images > 512x512 pixels
- 2-5x speedup on compatible hardware
- Automatic memory cleanup after processing
- Batch processing with optional memory-efficient mode
- GPU memory management for CUDA-enabled systems
- Graceful fallback to original image on processing errors
- Comprehensive error messages with troubleshooting hints
- Optional fail-fast mode for batch processing
- Efficient algorithms with O(N log N) complexity for frequency domain operations
- Optimized parameter selection to reduce computational overhead
- Multi-threading support where available
- Wavelet Denoising: 0.5-2 seconds
- Non-Local Means: 2-8 seconds
- Homomorphic Filtering: 0.3-1 second
- Richardson-Lucy: 1-10 seconds (depends on iterations)
- Batch Processing: ~1.2x single image time per image
- Peak memory: 2-4x input image size
- Batch processing: Configurable memory vs. speed tradeoff
- GPU acceleration: Significant speedup for large images
-
Import Error: "No module named 'pywt'"
- Solution: Install PyWavelets:
pip install PyWavelets
- Solution: Install PyWavelets:
-
Out of Memory Error
- Enable memory-efficient mode in batch processing
- Reduce batch size
- Use smaller decomposition levels for wavelets
-
Slow Processing
- Reduce iterations for Richardson-Lucy deconvolution
- Use faster wavelet types (haar, db4)
- Enable fast mode for Non-Local Means
-
Poor Results
- Check image format (should be 0-255 range)
- Adjust parameters based on image content
- Use adaptive methods for automatic parameter selection
-
GPU Acceleration Issues
- "CuPy not available": Install CuPy with
pip install cupy-cuda12x - "GPU transfer failed": GPU memory insufficient, reduce image size or use CPU
- "CUDA out of memory": Close other GPU applications or reduce batch size
- "CuPy not available": Install CuPy with
-
Film Grain Processing Issues
- Poor grain detection: Try manual grain type specification
- Over-denoising: Increase preservation level (0.7-0.9)
- Under-denoising: Decrease preservation level (0.3-0.5)
- Artifacts: Enable multi-stage processing and edge preservation
- Uses PyWavelets 1.6.0 with advanced thresholding
- Implements BayesShrink:
threshold = σ²/√(max(0, variance - σ²)) - Supports both regular DWT and stationary SWT transforms
- Based on Buades-Coll-Morel algorithm
- Automatic parameter estimation using noise variance
- Optimized patch comparison with early termination
- Separates illumination and reflectance:
I(x,y) = L(x,y) × R(x,y) - Applies frequency domain filtering:
H(u,v) = (γH - γL)[1 - G(u,v)] + γL - Supports Gaussian and Butterworth filter shapes
- Multi-Domain Analysis: Combines noise statistics, frequency analysis, texture features, and grain structure
- Grain Classification: Uses decision tree based on high-frequency ratio, grain regularity, and SNR
- Adaptive Processing: Tailors denoising strategy based on detected grain type:
- Authentic Film: BayesShrink wavelet + selective grain enhancement
- Digital Noise: Non-local means + SureShrink wavelet + edge enhancement
- Simulated Overlay: Frequency filtering + VisuShrink wavelet + texture preservation
- GPU Acceleration: Uses CuPy for wavelet coefficient thresholding and variance calculations
- Memory Optimization: Processes coefficients on GPU, reconstructs on CPU to minimize memory usage
- Donoho, D.L., & Johnstone, I.M. (1995). "Adapting to Unknown Smoothness via Wavelet Shrinkage"
- Buades, A., Coll, B., & Morel, J.M. (2005). "A Non-Local Algorithm for Image Denoising"
- Gonzalez, R.C., & Woods, R.E. (2017). "Digital Image Processing"
- Richardson, W.H. (1972). "Bayesian-Based Iterative Method of Image Restoration"
- Wiener, N. (1949). "Extrapolation, Interpolation, and Smoothing of Stationary Time Series"
- Chang, S.G., Yu, B., & Vetterli, M. (2000). "Adaptive Wavelet Thresholding for Image Denoising and Compression"
- Portilla, J., Strela, V., Wainwright, M.J., & Simoncelli, E.P. (2003). "Image Denoising Using Scale Mixtures of Gaussians in the Wavelet Domain"
- Foi, A., Trimeche, M., Katkovnik, V., & Egiazarian, K. (2008). "Practical Poissonian-Gaussian Noise Modeling and Fitting for Single-Image Raw-Data"
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For support, please open an issue on the GitHub repository with:
- Your ComfyUI version
- Error messages (if any)
- Sample images (if relevant)
- Processing parameters used
Made with ❤️ for the ComfyUI community