University of Utah Photographic Tone Reproduction for Digital Images
Erik Reinhard, Mike Stark, Peter Shirley and Jim Ferwerda
Cornell University

Source code
download
Parameters
Syntax:

tonemap -i inputfile -o outputfile [options]

The input and output files are in Radiance rgbe format by default. For input files in Jack Tumblin's floating point format, the -lay option should be given. Output files are written in ppm raw format if the -ppm option is specified.

Other options are:

-key float Set key value (a in equation 2)
-white float Set white point (L_white in equation 4)
-gamma float Gamma correction (value applied after compression)
-scale Use dodging and burning version (eqs 5 to 8)
-threshold float Scale selection threshold (epsilon in eq 8)
-phi float Sharpening parameter (phi in eq 7)
-num int Number of scales to use
-low int Size of smallest scale in pixels
-high int Size of largest scale in pixels

The default values are:

key = 0.18
white = 1e20 (i.e. use eq 3 instead of 4)
gamma = 1.6
threshold = 0.05
phi = 8.0
num = 8
low = 1
high = 43

If no options are given, equation 3 is applied with a key value of 0.18 and the result is gamma corrected to a value of 1.6.

For most images, only the key value needs to be specified. If the input data is extremely high dynamic range, then the dodging and burning technique should be applied by specifying the -scale option. For low dynamic range images, the white point should be lowered to avoid excessive contrast reduction. A value of about 1.5 should be good. In most cases, the -phi, -num, -low and -high parameters should not be altered. We have not found images where the default values produced unsatisfactory results.

Examples
The operator of equation 3:
tonemap -i nave.pic -o nave_tonemapped.ppm -ppm -key 0.09

The operator of equation 4:
tonemap -i nave.pic -o nave_tonemapped.ppm -ppm -key 0.09 -white 1.5

The operator of equations 5 to 8:
tonemap -i memorial.pic -o memorial_dodge.ppm -ppm -scale -key 0.18

Write an image in Radiance rgbe format:
tonemap -i memorial.pic -o memorial_dodge.pic -scale -key 0.18


Source code by Erik Reinhard and Mike Stark. The Radiance read and write functions are courtesy of Greg Ward.