A method of automatic mapping of image data includes representing image
data for an image as luminance values, determining a key value as a
function of an average luminance value of the image and of minimum and
maximum luminance values of the image, generating offset-adjusted
luminance values including applying an offset to each of the luminance
values, the offset being a function of the determined key value, and
computing a tone reproduction curve for at least a region of the image
which includes applying a mapping function to the offset-adjusted
luminance values.