DOGMA v40 Opaque Local Stitch
The paste-back node that respects no-op crops
- base_image
- patches
- masks
- stitch
- image
- info
DOGMAOpaqueLocalStitchV40 is the pack's general-purpose paste-back for local repairs, and it's a small but real improvement on v37: it iterates over the actual minimum length of the three lists instead of clamping, and it skips crops the crop node marked as no-ops.
If you're coming from v37, here's the practical difference. v37 walks the stitch list and pairs each entry with min(i, last) of the patches - convenient, and quietly wrong when the lists get out of sync. v40 loops min(len(patches), len(masks), len(stitch)) and steps aside for any meta dict with noop: True, which is exactly what a crop node emits when it found no valid object and returned a centred dummy crop. So a frame with nothing to repair passes through v40 untouched instead of getting a pointless 768px blur stamped into the middle.
The blend
core = (m > 0.52).float()
soft = avg_pool2d(m, 21, 1, 10).clamp(0,1)
alpha = torch.maximum(core, soft * 0.72)
Confidence 0.52 for the hard core, a 21px box feather scaled to 0.72, and maximum so the core is fully opaque while the rim ramps down. Patches come in bicubic-resampled to the recorded rectangle, masks bilinear, and the composite is clipped to 0–1 and written into RGB only. info reports v40 opaque local stitch: N edited crop(s) - the count is the number of regions actually composited, which is your one-line sanity check that the pipeline did anything at all.
Inputs and outputs
Four in: base_image, patches, masks, stitch. Two out: image (the composited master) and info. List-mode, so patches/masks/stitch take the list outputs straight off a crop node without any unpacking, and base_image takes a single image.
The rule to internalise: stitch is the contract. It's a list of dicts carrying x, y, width, height for each crop, produced by whichever crop node built them. Never rebuild it, never sort one list without the other, and never feed this node crops from a different master than the base_image - the coordinates are absolute pixels, and a mismatch lands every patch offset by the size difference.
Install
ComfyUI Manager → search DOGMA Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
# restart ComfyUI
No Python dependencies. Like the rest of the semantic family, the README doesn't document it - the v40 group of nodes is one of dozens of versions that ship together in a single 10,000-line module, all registered side by side.
Gotchas
noop skipping is a feature and a diagnostic. If info says 0 edited crop(s), either every crop was a no-op or your lists were empty. Both mean nothing downstream of the crop stage happened, and the thing to check is your SAM masks - not the sampler, not the denoise.
Opaque cores can clip a corrected silhouette. The hard core is built from crop_masks, which the crop node reconstructed from the selected SAM objects. If the repair legitimately needs to grow the object - a wheel that was too small, a limb that was missing - the paste will cut it off at the old mask boundary. Later versions in this pack add a per-kind pixel growth for exactly that reason; with v40 you widen the mask upstream instead.
Two stitches in one graph share coordinates. If you repair two overlapping sets of crops and stitch them in sequence, the second paste overwrites the first wherever they overlap. Order the stitches deliberately, or partition the masks before cropping.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| base_image | IMAGE | — | |
| patches | IMAGE | — | |
| masks | MASK | — | |
| stitch | DOGMA_STITCH | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| info | STRING | — |