图像分区 · 遮罩高频迁移
Steal back the texture your edit model smoothed away — without importing the flat color
- generated_image
- original_image
- mask
- detail_restored_image
- high_frequency_preview
- effective_detail_mask
- report_json
Here's the second-most common local-edit tell, after color: texture. Edit models are smooth. They render a flawless face, a clean wall, an even tabletop - and the original photo has grain, pores, weave, noise, all the fine detail that makes a photo look like a photo. When you composite the edited region next to untouched source, the difference is immediately visible as "too clean." RegionEditMaskedHighFrequencyTransfer fixes that by adding the source's high-frequency detail back into the generated region - without importing the source's low-frequency color, which is the whole trick.
It's the texture half of the pack's Color & Detail group (the color half is RegionEditMaskedGlobalLabMatch). The mechanism is a classic high-pass/low-pass split: separate each image into low-frequency (blurred) and high-frequency (original minus blurred) components. The high-frequency component of the original - grain, pores, texture - gets added into the generated image. The generated image's low-frequency component is left alone, so the edit's color and shading stay whatever the model made, and you only re-inject the detail layer.
How it works
The four inputs are all knobs on the same idea:
high_frequency_radius(default 2.0) - the blur radius that defines the low/high split. Smaller radius = you're grabbing finer detail only; larger = you're pushing more of the mid-frequency structure too.detail_strength(default 0.35) - how much of the source detail gets added. 0.35 is subtle; the range goes to 1.5 for people who want aggressive grain restoration.edge_protection_start(0.035) /edge_protection_end(0.12) - the anti-ghosting control. Strong structural edges (the source's jawline, a table edge) get attenuated so that a slightly shifted source contour can't create a duplicated bright/dark outline on the generated subject. The band between the two values is where edges are ramped down.
Two implementation details are worth knowing because they're the difference between "works" and "ghosts": the padding is reflective Gaussian (so the crop boundary doesn't itself become a false high-frequency line), and the source's low-frequency image is never mixed into the result - only the high-frequency layer travels.
Outputs: detail_restored_image (what you composite), high_frequency_preview (the extracted detail layer - great for checking you're not about to inject a garbage pattern), effective_detail_mask (where detail was actually applied, after edge attenuation), and report_json.
Inputs that matter
generated_image/original_image/mask- aligned crops plus the region to treat.detail_strength- the one you'll tune most. If the region still reads "plastic," raise it; if you see texture crawling onto smooth areas, lower it.
Install
ComfyUI Manager → search "Region Edit Toolkit" (package ID native-region-tile-planner-merge) → install → restart. Or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip install -r requirements.txt into ComfyUI's Python, restart. Python 3.10+, deps numpy/Pillow/scipy/argostranslate, no models.
Gotchas
The edge-protection defaults are tuned for faces (small structures, soft contours). On a scene with strong geometry - a hard object outline, a building line - a shifted edge will still ghost if the source and generated geometry disagree, so check the high_frequency_preview before committing. And the order matters in the pack's pipeline: transfer texture before the Lab color match, not after - if you color-correct after texture transfer you'll tint the freshly-added grain, which is a subtle way to make the seam worse instead of better.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| generated_image | IMAGE | — | |
| original_image | IMAGE | — | |
| mask | MASK | — | |
| high_frequency_radius | FLOAT | 2.000.5–32 | — |
| detail_strength | FLOAT | 0.350–1.5 | — |
| edge_protection_start | FLOAT | 0.0350–1 | — |
| edge_protection_end | FLOAT | 0.1200.001–1 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| detail_restored_image | IMAGE | — |
| high_frequency_preview | IMAGE | — |
| effective_detail_mask | MASK | — |
| report_json | STRING | — |