removes the outermost branches of thin objects in image by setting their values to black.


removes branches that are at most n pixels long.


removes n pixels from each branch.


treats values above t as foreground.

Details and Options

  • Morphological pruning is typically applied after morphological thinning.
  • Pruning works with binary, grayscale, and multichannel images, as well as real matrices.
  • Pruning takes a Padding option that specifies the values to assume for pixels outside the image. The default setting is Padding->0.


open allclose all

Basic Examples  (4)

Prune the outermost branches:

Prune branches that are no longer than 35 pixels:

Prune 35 pixels from branches:

Prune all branches:

Scope  (1)

Apply pruning to a numeric array of data:

Applications  (3)

Count the legs of a centipede:

Compute the difference between skeleton and pruned skeleton:

Count of legs would be equivalent to the number of pruned branches:

Find the loops of a graph:

Iteratively prune an image:

Neat Examples  (1)

Solve a maze puzzle by thinning all paths and pruning dead ends:

Introduced in 2010