
A nearly black distance map can contain valid small distance values. ImageMagick's documented Distance morphology assigns values describing distance from zero-valued background. Keep the original numeric field, and make a separate auto-leveled viewing copy if the shape is difficult to see.
Start with a binary shape
The official morphology examples describe white foreground on black background for this method. Establish that representation before applying a distance kernel; a photograph with gray texture is not the same input contract.
A proposed POSIX-shell example is:
magick shape.png -threshold 50% +depth -morphology Distance Euclidean:4 distance-data.png
The threshold is illustrative, not a validated segmentation choice. This command has not been executed. The examples include historical version notes, so confirm the installed ImageMagick 7 methods, kernels and precision before use.
Preserve the quantitative interpretation
Record the kernel, its scale and the build's quantum precision. The official example explains that small distances can occupy only a small portion of the available channel range. Dark appearance alone therefore does not establish an empty result.
+depth returns to the build's default depth; it is not a universal instruction for sixteen-bit output on every installation. The source specifically cautions about Q8 accuracy for fractional distance kernels. Choose storage that preserves the values required by the receiving calculation.
Make a display-only derivative
For viewing, the documented approach can be expressed as:
magick distance-data.png -auto-level distance-view.png
Auto-leveling changes the numeric scale so the field becomes easier to see. Label that output as a visualization rather than silently substituting it for the measurement field.
The black-point guide protects photographic shadow detail. Here a dark value is a computed measurement whose interpretation must survive, rather than a photographic exposure to improve.
Check distance semantics separately from shape appearance
Inspect a known binary boundary and an interior location, using the recorded kernel scale. Do not infer physical millimeters without a separate pixel-to-physical calibration.
The vector offset guide constructs a contour; this task creates a raster field over the shape. Acceptance requires a traceable numeric map plus a clearly separate viewing derivative. No exact-distance benchmark, segmentation test or conversion has been performed.
Related tasks
- Why Does Scaling an Illustrator Shape Not Produce an Even Border?
- Why Do Dark Clothes Lose Their Texture After I Add Contrast?
Sources and scope
- ImageMagick morphology examples: distance: Distance morphology measures foreground distance from zero-valued background; low numeric magnitudes can look black and auto-leveling changes their quantitative scale.
- ImageMagick 7 morphology operator: Current command-line reference links to the official morphology examples; confirm installed methods and kernels.
The official ImageMagick morphology usage page was captured with HTTP 200 on October 23, 2026. It includes historical examples and explicit legacy version notes. Commands, calculations and acceptance exercises here are proposed, not executed; verify the installed ImageMagick 7 methods, kernel behavior, quantum precision 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: Pignatta / Pixabay, Pixabay Content License. This is an illustrative source photograph, not an application screenshot or a generated test result.