We present a general theory for the morphological representation of discrete and binary images. The basis of this theory relies upon the generation of a set of nonoverlapping segments of an image via repeated erosions and set transformations, which in turn produces a decomposition that guarantees exact reconstruction. We introduce a general morphological representation and we study its properties. We also investigate the relationship between the proposed representation and some existing shape analysis tools (e.g., discrete size transform, pattern spectrum, skeletons), thus introducing the representation as the basis of a unified theory for geometrical image analysis. Particular cases of the general representation scheme are shown to yield a number of useful image decompositions which are directly related to various forms of morphological skeletons. We study the relationship between the representation and the various forms of morphological skeletons. As a result of this study we develop a unified theory for the mathematical description of the morphological skeleton decomposition of discrete and binary images.