The adaptive contrast enhancement (ACE) algorithm, which uses contrast gains (CG's) to adjust the highfrequency components of images, is a well-known technique for medical image processing. Conventionally, the CG is either a constant or inversely proportional to the local standard deviation (LSD). However, it is known that conventional approaches entail noise overenhancement and ringing artifacts. In this paper, we present a new ACE algorithm that eliminates these problems. First, a mathematical model for the LSD distribution is proposed by extending Hunt's image model. Then, the CG is formulated as a function of the LSD. The function, which is nonlinear, is determined by the transformation between the LSD histogram and a desired LSD distribution. Using our formulation, it can be shown that conventional ACE's use linear functions to compute the new CG's. It is the proposed nonlinear function that produces an adequate CG resulting in little noise overenhancement and fewer ringing artifacts. Finally, simulations using some X-ray images are provided to demonstrate the effectiveness of our new algorithm.