Image_CnMapMix
A Photoshop-style layer blender for building composite control maps
- image1
- image2
- mask2
- IMAGE
ControlNet conditions generation on a spatial map - edges, depth, pose. Sometimes one map isn't enough: you want the edges from one preprocessor pass and the depth structure from another, or you need a mask built from exactly where two conditioning images disagree. Image_CnMapMix is a general two-layer blender built with that job in mind - the "CnMap" in the name is short for "control(net) map" - though there's nothing stopping you using it as a plain layer-blend tool for any two images, ControlNet or not.
How it works
image1 and image2 (both optional - you can drive the node off just one plus bg_color if you want) each get an independent levels pass first: image1_min_black/image1_max_white and their image2_* equivalents remap each layer's black and white points before anything else happens, the same idea as Levels in Photoshop. blur_1/blur_2 soften each source. Then they're combined through one of ten blend_mode options - normal, multiply, screen, overlay, soft_light, difference, add, subtract, lighten, darken - at a blend_factor (opacity, 0–1), with a final contrast/brightness grade applied to the result.
There's also a built-in diff generator: diff_sensitivity and diff_blur build an automatic mask from wherever image1 and image2 disagree - handy for spotting exactly where two conditioning maps diverge without painting anything by hand. An optional mask2, plus mask2_smoothness and invert_mask, give you manual control over the blend region instead. bg_color (image/white/black/gray) is the fallback backdrop when there's nothing behind the blend.
The inputs and outputs that matter
blend_mode,blend_factor- the actual combination math and its strength.image1,image2(both optional) - your two layers.diff_sensitivity/diff_blurvsmask2/mask2_smoothness- two different ways to control where the blend applies: automatic (from the images' own difference) or manual (a mask you supply).image1_min_black/image1_max_white/image2_min_black/image2_max_white- per-layer levels, applied before blending.- Output:
IMAGE- the blended result.
How to install it
Via ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Windows: install.bat. Linux/Mac: pip install -r ComfyUI-Apt_Preset/requirements.txt in your venv. Restart ComfyUI. Nothing to download for this node - pure image math - though the pack's dependency list is heavier than that alone would suggest, since Apt_Preset (~300 GitHub stars, MIT, actively updated) bundles GGUF loading, audio and video tooling alongside its image nodes in one install.
Common issues & troubleshooting
Result looks like image1 untouched. blend_mode has no listed default in the schema, so don't assume it's on "normal" - check what it's actually set to. Also check blend_factor isn't sitting near 0, which would make any blend mode look like a no-op.
Two maps that don't line up. If image1 and image2 come from different preprocessor passes at different resolutions (a canny map here, a depth map there), this node doesn't handle the mismatch for you - line them up first with Image_CnMap_Resize before feeding them in.
Diff mask coming out empty or solid. diff_sensitivity has a narrow range (−0.2 to 0.2) - small moves matter a lot more than they look like they should. Nudge it in tiny steps rather than large jumps if the automatic diff mask isn't picking up the difference you expect.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| bg_color | COMBO | image | 4 options: image, white, black, gray |
| blur_1 | INT | 00–1000 | — |
| blur_2 | INT | 00–1000 | — |
| diff_sensitivity | FLOAT | 0.00-0.2–0.2 | — |
| diff_blur | INT | 00–1000 | — |
| blend_mode | COMBO | 10 options: normal, multiply, screen, overlay, soft_light, difference, +4 | |
| blend_factor | FLOAT | 0.500–1 | — |
| contrast | FLOAT | 1.00–3 | — |
| brightness | FLOAT | 0.00-1–1 | — |
| mask2_smoothness | INT | 00–500 | — |
| invert_mask | BOOLEAN | false | — |
| image1_min_black | FLOAT | 0.000–1 | — |
| image1_max_white | FLOAT | 1.000–1 | — |
| image2_min_black | FLOAT | 0.000–1 | — |
| image2_max_white | FLOAT | 1.000–1 | — |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| mask2opt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |