
To regrow only selected binary shapes from seed pixels, constrain dilation with a write-protected background. Unconstrained repeated dilation can spread outside the intended objects. ImageMagick's conditional-dilation examples show a separate mask limiting where new foreground pixels may be written.
Prepare allowed shapes and valid seeds
Keep the original binary shape image. Create seed points that lie inside the components you want to reconstruct, and verify that unrelated components contain no seeds.
The documented setup uses a write-protect mask derived by negating the original shape image: the background becomes protected while the original shape interiors permit growth. Inspect mask polarity explicitly rather than inferring it from a viewer's checkerboard.
Apply bounded growth
For already prepared seed and protection images, a proposed POSIX-shell pattern is:
magick seeds.png -write-mask protected-background.png -morphology Dilate:15 Diamond +write-mask reconstructed.png
The iteration count is illustrative, not a sufficient bound for every shape. This command has not been executed. Confirm current ImageMagick 7 mask and morphology behavior against a small known fixture.
The official usage examples contain a historical warning about convergence detection with write masks. Do not copy -1 unbounded iteration into this recipe or assert that the warning describes every current release. Choose a bounded run and inspect whether the intended reconstruction actually completed.
Keep kernels small enough for the separation
The source warns that a large neighborhood can jump gaps between objects. A mask prevents writing in protected pixels, but a large kernel may still reach another permitted component beyond that gap.
Use a controlled pair of separated shapes to examine that risk. Check both the intended seeded object and the unseeded neighbor; the number of white pixels alone cannot establish correct membership.
Distinguish reconstruction from smoothing
The manual contrasts conditional dilation with ordinary opening, which can restore the kernel's internal shape rather than the exact original object. The accepted artifact here should recover the permitted connected shape reached from the seeds, not simply look smoother.
The connected-selection guide starts from a clicked region. This setup explicitly supplies multiple seeds and a protection image. The interior-hole guide helps identify protected openings, but does not execute reconstruction.
Retain the input, seeds, mask and bounded count. No completed restoration, runtime guarantee or current-build regression claim is made.
Related tasks
- GIMP Fuzzy Select vs. Select by Color: Which One Captures Only the Background?
- Why Does Background Removal Fill the Holes Inside Earrings and Handles?
Sources and scope
- ImageMagick official mechanism reference: Conditional dilation limits seed growth using a write-protect mask; small kernels avoid jumping gaps, and historical examples warn against unbounded convergence with a write mask.
Official ImageMagick references were captured October 23, 2026. Morphology usage includes historical and experimental notes, which do not establish current-build regressions or guarantees. Examples and acceptance checks are proposed, not executed; confirm installed-build support, pixel representation and shell syntax.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: Mariya Eskina / Pexels, Pexels License. This is an illustrative source photograph, not an application screenshot or a generated test result.