Here I'll give an example of how to process a file containing high dynamic range image data into a final image, ready for display, by using both pfstools and imagemagick. To generate the high dynamic range data you'll need a few exposures of the same scene, and I recommend reading the manual for PFScalibration. Of course, you can also use HDR data generated with any other program.
I'll use pfstmo_mantiuk06 as a tonemapping operator, but any other tonemapping operator could be used, or you might even not need a tonemapping operator, as you'll see.
Since some of those operators cut global contrast too much for my taste, but are quite effective in reducing contrast in a "natural" way I'll use a direct mapping simultaneously, and blend both results, so that you can give more or less weight to the tonemapping operator, to suit your tastes, instead of simply not using those "aggressive" tonemapping operators.
These are examples
only! You should change parameters, and tonemapping methods, and generally play around with pfstools to suit your taste! Reading the manual is also advisable, even more since I included placeholders instead of numeric values for the parameters.
The values I suggest later have worked for this image:
--> click for larger version <--
They probably won't work for most other images.
This was copied/adapted from a php script I made to automatically process HDR images a year ago. I hope there aren't any gross mistakes...
Ok, so let's start with our EXR file containing the data, input.exr :
1 - Tonemapping
pfsin --frames 0:1:0 input.exr | \
pfstmo_mantiuk06 --factor $factor --saturation $saturation | \
pfsgamma --gamma 2.2 --mul 1.0 | \
pfsoutexr --compression PIZ --fix-halfmax temp00.exr
2 - Contrast stretch (direct mapping)
convert input.exr -auto-level -linear-stretch $black%x$white% -gamma 1.0 -compress Piz temp01.exr
3 - Blending both results
composite -blend $blend_factor% temp00.exr temp01.exr -matte -compress Piz temp02.exr
4 - Final image processing
convert temp02.exr -auto-level -gamma $gamma_correction_luminance \
-channel Red -gamma $gamma_correction_red \
-channel Green -gamma $gamma_correction_green \ // setting the RGB gamma separately allows changes in white balance
-channel Blue -gamma $gamma_correction_blue \
+channel -depth 16
//-sigmoidal contrast $sigmoidal_contrast_factorx$sigmoidal_contrast_grey% \ // use sigmoidal contrast only if needed
//+sigmoidal contrast $sigmoidal_contrast_factorx$sigmoidal_contrast_grey% \ // you can decrease contrast also
-set option:modulate:colorspace hsb -modulate 100,$saturation_correction,100 \ // hsb avoids color clamping
-auto-level -linear-stretch $contrast_stretch_black%x$contrast_stretch_white% -clamp \
-depth 8 -interlace line -quality 98 -sampling-factor 1x1 output.jpg
Example parameters for 1:
$factor = 0.3
$saturation = 0.8
Example parameters for 2:
$black = 0 // black out zero pixels
$white = 0 // white out zero pixels
Example parameters for 3:
$blend_factor = 50 // blend half-half
Example parameters for 4:
$gamma_correction_luminance = 3
$gamma_correction_red = 1.04
$gamma_correction_green = 1.0
$sigmoidal_contrast_factor = 2.5
$sigmoidal_contrast_grey = 33
$saturation_correction = 200
$contrast_stretch_black = 0.01
$contrast_stretch_white = 0.01
Suggestions, questions, please go ahead