DOGMA Reflect Pad v23 — Border Context
Give edge objects some pixel context to lean on
- image
- image
- info
Two inputs, two outputs, and it's the smallest node in the pack. DOGMAReflectPadV23 mirrors pad pixels of image around all four sides so that anything you crop near the frame edge has real neighbourhood to sit in.
Why you'd want that: a car at the right edge of the frame, cropped for a local repair pass, arrives at the model with a hard boundary where the image ends. Models handle edges badly - they either smear the last column of pixels outward, or they invent content that doesn't match what's one pixel outside the crop. Give them mirrored context instead and the crop is bounded by plausible pixels on every side. Same argument as mask blur in inpainting: the seam is where things go wrong, so feed the model past the seam.
How it works
image in, pad (default 256, range 0–1024, step 16) in, image and info out. pad=0 returns the image unchanged and says v23 pad disabled.
The mode choice is the only clever bit. It uses reflection when pad is smaller than both the height and the width - a genuine mirror of the image content - and falls back to replication (edge pixel stretched outward) when the image is too small to reflect without self-overlap. info tells you which one you got: v23 reflect context pad: 256px each side | 4096x2731 -> 4608x3243.
That's it. It's a padding node, and the reason it exists in this pack rather than being borrowed from any generic image-utility suite is that DOGMA's crop stages work on objects, and objects live at frame edges constantly - the car half out of shot, the shopfront running off the left side.
How it fits
Pad first, then segment and crop the padded image, then work in padded coordinates. The pack ships the matching inverse in the same file - a centre-crop-to-reference-scale node - which takes the padded result back to an exact reference multiple of the original size. So the pattern is: reflect-pad, run the restoration pass with real border context, centre-crop back. Note that the crop and stitch nodes record source_width/source_height in their stitch metadata, so if you pad between stages you need to be consistent about which coordinate space your masks are in - padded-in, padded-out is the version that doesn't bite you.
The other honest use is simply "the model keeps producing a black bar at the bottom edge". That's usually a missing-context problem, and 128–256px of reflection fixes it more cheaply than raising denoise and hoping.
Install
ComfyUI Manager → search DOGMA Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
# restart ComfyUI
Zero dependencies - this is a single torch.nn.functional.pad call and a string. The README doesn't cover the semantic nodes, so if you found this page by googling the node name, the summary above is more than the app will tell you.
Gotchas
Reflection is not free context. A mirrored car at the edge means the model sees a second, impossible car reflected in the margin. For textures - asphalt, brick, foliage, sky - that's fine. For a large distinct object at the very edge, keep pad modest or you'll seed a duplicate.
Replication mode looks worse than it sounds. When the image is smaller than the pad, edge pixels get stretched, and a stretched row of sky at the bottom of a crop is exactly the "smeared border" artefact you were trying to avoid. Keep images at least 2× pad in each dimension.
It pads, it doesn't crop. There's no crop-back in this node, and adding one by hand with a core crop node is where off-by-pad errors creep in. Do the padding once, early, before coordinates get recorded.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| pad | INT | 2560–1024 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| info | STRING | — |