A novel approach for shape preserving contrast enhancement is presented in this paper. Contrast enhancement is achieved by means of a local histogram equalization algorithm which preserves the level-sets of the image. This basic property is violated by common local schemes, thereby introducing spurious objects and modifying the image information. The scheme is based on equalizing the histogram in all the connected components of the image, which are defined based on the image grey-values and spatial relations between its pixels. Following mathematical morphology, these constitute the basic objects in the scene. We give examples for both grey-valued and color images.