⚗ Alchemica · Photo · compose (keep the rest identical) [1.0, use Alchemica Photo Composite (keep the rest identical)]
Keeping everything except the bit you changed
- originale
- nuova
- maschera
- immagine
The whole point of retouching a photo with a generative model is that you want the other 95% of the image untouched. Every img2img node that re-encodes and re-decodes the whole frame quietly changes all of it - a little bit everywhere, and that's before you compare it against the original.
This node makes that promise explicit: outside the mask, the original photo comes back identical, pixel for pixel.
What it is
Three inputs, one output, and it does exactly what a compositing application does.
originale- thefotooutput of ⚗ Photo · prepare, i.e. the resized/upscaled working image, not your source file.nuova- the decoded result of the sampler.maschera- themascheraoutput of ⚗ Photo · prepare: the painted zone, already grown and feathered by that node.
Output: immagine.
The maths is a straight lerp - original * (1 − mask) + new * mask - after resizing the new image to the original's dimensions if they differ. There's one edge case worth knowing because it's deliberate: if the mask comes in fully saturated (every value ≥ 0.999), there is nothing to protect and the new image passes through unchanged. That's how "no mask" behaves without erroring.
All the feathering happens upstream. The soft edge, the 24-pixel default falloff, the growth around the painted zone - that's sfuma_maschera and allarga_maschera on the prepare node. This node just applies whatever mask it's given, hard. Which means if you want to change the blend edge, you change it there, not here.
Wiring
┌─ latent ──► sampler ── image ─┐
Load Image ─ foto ──► ⚗ Photo · prepare ▼
└─ foto ──────────► ⚗ Photo · compose ──► Save
└─ maschera ───────►
Two ways to get this wrong, and both look fine until you compare. Feeding the compose node your original Load Image file instead of the prepare node's foto (they can differ in size after an upscale, and the resize will soften the whole frame). And feeding the sampler's latent somewhere else and using a stale image.
Why use it at all, when the sampler has a mask input
You can, absolutely - ComfyUI's own img2img-masking path does the same painting. What this buys you is that the untouchable part is guaranteed by construction rather than by a noising schedule: the model never gets to leave a ghost of itself outside the mask, and you get the exact pixels back. For skin, text, jewellery, a signature, a bit of architecture - anything where "close enough" is visible - that matters.
It also pairs neatly with DeGrid and the monochrome node, because it sits right before the save and keeps the whole chain honest about what changed.
Installing
# ComfyUI Manager: search "AlchemicaSampler"
cd ComfyUI/custom_nodes && git clone https://github.com/Nessuno76/ComfyUI-AlchemicaSampler
ComfyUI 0.36+ for the pack, no pip dependencies, restart the ComfyUI server afterwards. The English twin of this node is ⚗ Alchemica Photo Composite, and legacy nodes are hidden from search - you'll find this one under right-click → Add Node → ⚗ AlchemicaMente → legacy (1.0). Port it if you're building anything new: originale → original, nuova → new, maschera → mask, output immagine → image.
Common issues
A visible seam. Almost always the mask, not this node: raise the feather on the prepare node and re-queue, or grow the mask a few more pixels so the model has boundary context to work with.
The whole frame changed. You passed the same image into both inputs, or the mask came through empty and the sampler re-drew everything. An empty mask equals the whole photo, by design.
A soft result. The new image was a different size and got resized. Use the foto output of prepare as originale, and make sure the sampler worked at the same resolution - the prepare node's report and the sampler's report both tell you what size they were actually working at.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| originale | IMAGE | 'foto' from ⚗ Photo · prepare | |
| nuova | IMAGE | The decoded result of ⚗ AlchemicaKrea | |
| maschera | MASK | 'maschera' from ⚗ Photo · prepare |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| immagine | IMAGE | — |