A method and apparatus for automatically and adaptively generating tonescale transformation functions that are robust with respect to imaging systems, exposure conditions, and body parts. The technique uses the histogram of the digital input image, the cumulative distribution function of the histogram, and the entropy of subsections of the histogram to create the final tonescale transformation. Using these three functions, the histogram can be divided into a region of interest, a low-signal foreground region, and a high-signal background region. The tonescale is constructed to be substantially linear over the region of interest, joining smoothly with a nonlinear portion extending from the end of the low-signal foreground region to the start of the region of interest, and another nonlinear portion of the high-signal background region. The substantially linear region of interest and the entire image are subject to certain output density constraints to optimize the diagnostic utility of the final image. The technique depends entirely on the histogram of the input image, and, hence, it is adaptive and robust.