ComfyUI Extension: ComfyUI-StableManifoldCompander
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
ComfyUI custom nodes for correcting FLUX.2 high-resolution drift, washout, and crop reintegration artifacts with anchor-guided and affine companding workflows
Looking for a different extension?
Custom Nodes (24)
- SMC Affine Anchor Resize
- SMC Affine Compand
- SMC Affine Estimate Drift
- SMC Affine Low / High Split
- SMC Affine Profile
- SMC Affine Recombine
- SMC Anchor Resolution
- SMC Anchor-Guided Compand
- SMC Compand Blend
- SMC Composite Crop
- SMC Config
- SMC Describe Config
- SMC Self-Anchor Detailer Hook Provider
- SMC Extract Masked Crop
- SMC Frequency Split
- SMC Make Anchor
- SMC Self-Anchor Detailer Hook Provider
- Stable Manifold Anchor Resize
- Stable Manifold Compand
- Stable Manifold Estimate Drift
- Stable Manifold Low / High Split
- Stable Manifold Profile
- Stable Manifold Recombine
- Stable Manifold Self-Anchor Detailer Hook
README
ComfyUI Stable Manifold Compander
Stable Manifold Compander is a ComfyUI custom node pack for correcting the high-resolution drift that can show up in FLUX.2-style workflows, especially with detail crops, masked edits, and larger full-frame renders.
Instead of only resizing the image, the pack tries to pull the high-resolution result back toward a lower-resolution reference state that is usually compositionally more stable. In practice this helps counter issues such as:
- outward zoom or expansion drift
- low-frequency washout or relighting
- reduced color richness or chroma flattening
- crop-to-image mismatch after compositing a detailed region back into the source image
The pack includes a primary anchor-guided workflow for general use, an affine diagnostic/fallback workflow, and an optional Impact Pack hook for in-detailer correction.
What it does
The core idea is simple:
- derive or provide a lower-resolution anchor that represents the more stable version of the image or crop
- compare the high-resolution result against that anchor
- apply a controlled correction that pulls geometry and low-frequency structure inward without throwing away high-frequency detail
This makes the pack useful for both whole-image correction and crop-based detailing workflows.
Included nodes
Main workflow
- SMC Config
- SMC Make Anchor
- SMC Anchor Resolution
- SMC Anchor-Guided Compand
- SMC Extract Masked Crop
- SMC Composite Crop
- SMC Frequency Split
- SMC Compand Blend
- SMC Describe Config
Affine / diagnostic workflow
- SMC Affine Profile
- SMC Affine Anchor Resize
- SMC Affine Estimate Drift
- SMC Affine Compand
- SMC Affine Low / High Split
- SMC Affine Recombine
Optional Impact Pack integration
- SMC Self-Anchor Detailer Hook Provider
Recommended workflows
1. Masked crop detailing
This is the most useful workflow when a face, subject, or region drifts after high-resolution detailing.
- Create a mask for the region you want to process.
- Use SMC Extract Masked Crop to pull out the image region and crop mask.
- Run your normal upscale, detail, or edit pass on that crop.
- Use SMC Anchor-Guided Compand on the edited crop.
- Supply an explicit anchor if you already have a low-resolution reference.
- Otherwise let the node derive one from the configured anchor megapixel target.
- Paste the corrected crop back with SMC Composite Crop.
This workflow is usually the best fit for reducing crop expansion, relighting drift, and paste mismatch.
2. Whole-image correction
Use this when the full image drifts as resolution rises.
- Build a mask for the affected subject or area, or use a broad mask for the whole image.
- Create settings with SMC Config.
- Run SMC Anchor-Guided Compand on the high-resolution image.
- Use SMC Compand Blend if you want a softer or partial blend back to the original.
3. Diagnostic or fallback correction
Use the affine nodes when you want a more explicit and interpretable correction path.
The affine workflow is useful for:
- estimating scale and translation drift directly
- testing correction strength in a more controlled way
- older experiments where you want a clearer diagnostic readout
- the optional Impact Pack self-anchor hook
Node overview
SMC Config
Builds the main correction configuration used by the anchor-guided path.
Important controls:
- anchor_mp: target size of the internal low-resolution anchor
- warp_strength: overall strength of the inward correction
- radial_strength: how strongly the correction behaves like inward compaction
- lowfreq_anchor_mix: how much low-frequency structure is pulled toward the anchor
- chroma_restore / contrast_restore: restore color and tonal presence after correction
- detail_preservation: keeps high-frequency detail from collapsing
- max_inward_shift_px: safety cap on geometric correction magnitude
SMC Make Anchor
Creates a low-resolution anchor and also returns a resized version at the original resolution for inspection.
SMC Anchor Resolution
Calculates the anchor resolution for a given megapixel target while preserving aspect ratio.
SMC Anchor-Guided Compand
Main correction node. It takes a high-resolution image, a mask, and a config, then outputs:
- corrected image
- anchor image used internally
- warped intermediate
- flow visualization
- debug mask
- numeric metrics summary
SMC Extract Masked Crop / SMC Composite Crop
Utility nodes for crop-based workflows. These make it easier to extract a masked region, process it externally, and composite it back cleanly.
SMC Frequency Split / SMC Compand Blend
Inspection and finishing utilities. Use them to preview low/high components or blend the processed result back more gently.
Affine nodes
These expose a more explicit correction path based on drift estimation and affine-style compaction. They are especially useful when you want to inspect the estimated scale and translation values directly.
SMC Self-Anchor Detailer Hook Provider
Optional Impact Pack hook.
It stores the post-upscale crop as a self-anchor, then runs the affine compand path after decode. This is a practical fallback for FaceDetailer-style workflows when you want some correction inside the hook surface itself.
Installation
Clone or copy this repository into:
ComfyUI/custom_nodes/ComfyUI-Stable-Manifold-Compander
Then restart ComfyUI.
Requirements
No extra Python dependencies are required beyond a normal ComfyUI PyTorch installation.
For SMC Self-Anchor Detailer Hook Provider, you also need ComfyUI-Impact-Pack installed.
Notes and limitations
- SMC Extract Masked Crop and SMC Composite Crop currently support batch size 1 only.
- The main anchor-guided method is training-free and heuristic. It is not a learned deformation model, optical flow solver, or landmark-based warp.
- The Impact hook is a practical fallback, not a replacement for a true two-pass low-resolution anchor branch.
- Results depend heavily on mask quality and on choosing an anchor megapixel range that matches the model's stable regime.
When to use which path
Use the anchor-guided path when:
- you want the main intended workflow
- you are correcting FLUX.2 klein high-resolution drift directly
- you are working with masked crops or broad masked regions
Use the affine path when:
- you want direct drift estimates
- you need a more diagnostic or interpretable correction route
- you want the optional Impact Pack self-anchor hook
Files
core.py— anchor-guided compand implementationaffine_core.py— affine/profile correction implementationimpact_hook.py— Impact Pack self-anchor hooknodes.py— ComfyUI node registration and UI surface__init__.pypyproject.tomlrequirements.txt.gitignore
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.