An apparatus, method, computer useable medium, and processor programmed to automatically generate tone mapping curves in a digital camera based on image metadata are described. Rather than having a static tone mapping curve for all images, the curve can be varied automatically based on, e.g., the brightness histogram of the image. In one embodiment, a certain percentage of the least bright pixels and a certain percentage of the brightest pixels can be disregarded, while the remaining pixels can be linearly stretched to encompass the original range of brightness values. Based on the distribution of the resultant stretched brightness histogram, slopes for the low end (S0) and high end (S1) of the tone mapping curve can be independently determined, and the tone mapping curve can be automatically generated. The improved, automatically generated tone mapping curve may be able to lift shadows more aggressively and/or increase the dynamic range of the image.