Wolfsauge [deleted] 1:22am, 5 June 2006
If you want to process and create HDR based on open source or on the command line, like netpbm, it might be worthwhile to have a look at pfstools. In the following I will give you some links and a short overview on what you need to do.

You will need to install OpenEXR. It's Industrial Light & Magic's main image file format - the first movies to employ it were Harry Potter and the Sorcerers Stone, Men in Black II, Gangs of New York, and Signs.

You will need to install pfstools, pfscalibration and pfstmo.

Basic steps and statements
0. Realize the calculations can take quite a while. Downsize your images to a smaller size for testing purposes, that speeds up the calculations a lot. You can recalculate the original size with the final parameters subsequently.

1. Creating an image list. _dsc1766-1.jpg, _dsc1766-2.jpg and _dsc1766-3.jpg I have created from three bracketed NEF exposures and enhanced them with EXIF headers so that jpg2hdrgen recognizes the shutter speeds and aperture settings from the headers.

$ jpeg2hdrgen _dsc1766-1.jpg _dsc1766-2.jpg _dsc1766-3.jpg > _dsc1766-HDR.hdrgen

$ cat _dsc1766-HDR.hdrgen
cam/152/nef/_dsc1766-1.jpg 2.5 16.0 0 0
cam/152/nef/_dsc1766-2.jpg 12.987 16.0 0 0
cam/152/nef/_dsc1766-3.jpg 40 16.0 0 0

2. Create the camera response curve. This should be done with different pictures, not the ones you want to use pfstools with (please see also the pfstools documentation itself). For this simple test I ignored this advice. See the post of Grzesiek: below, for more information on how to create a smooth response curve that results in a better color rendition.

$ pfsinhdrgen _dsc1766-HDR.hdrgen | pfshdrcalibrate -v -s _dsc1766-HDR.response

Optionally having a look at the curve:
$ gnuplot
gnuplot> plot "_dsc1766-HDR.response" with dots

3. Create the HDR image.

$ pfsinhdrgen _dsc1766-HDR.hdrgen | pfshdrcalibrate -v -f _dsc1766-HDR.response | pfsoutexr _dsc1766-HDR.exr

Alternative (added later):
$ pfsinhdrgen _dsc1766-HDR.hdrgen | pfshdrcalibrate -v -f _dsc1766-HDR.response| pfsclamp --min 0.001 -p | pfsoutexr _dsc1766-HDR.exr

Using this additional command in the pipe clamps the color and luminance levels to be within the specified range.

4. Try the seven different tone mapping operators available.

$ pfsin _dsc1766-HDR.exr | pfstmo_ashikhmin02 | pfsout _dsc1766-HDR-pfstmo_ashikhmin02.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_drago03 | pfsout _dsc1766-HDR-pfstmo_drago03.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_durand02 | pfsout _dsc1766-HDR-pfstmo_durand02.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_fattal02 | pfsout _dsc1766-HDR-pfstmo_fattal02.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_pattanaik00 | pfsout _dsc1766-HDR-pfstmo_pattanaik00.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_reinhard02 | pfsout _dsc1766-HDR-pfstmo_reinhard02.jpg

$ pfsin _dsc1766-HDR.exr | pfstmo_reinhard04 | pfsout _dsc1766-HDR-pfstmo_reinhard04.jpg

5. Decide which implementation suits the particular image and eventually, recalculate with the original size.

6. If you are not happy with the results, check out the maskless blending technique.

You can also use a single RAW file to create the HDR image.

Removed all images and glue text, 2007-02-17, Wolfsauge.
Feileacán 10 years ago
I'll be checking this out as soon as I have finished my exams! Thanks a bunch! Any experience with the OSS Cinepaint and HDR, BTW?
Amery Carlson 10 years ago
nice work
Slipping Away PRO 10 years ago
I was wondering if there were open source tools for HDR. You have created a very explanatory tutorial. I'll give it a try and let you know of my experiments. Thanks!
Grzesiek: Posted 10 years ago. Edited by Grzesiek: (member) 10 years ago
thanks for writing a tutorial on pfstools!
I'd like to add a note on calibration (step 2 of your tutorial). It is often good to use a separate set of images to obtain the camera curve. The best targets are uniform, neutral surfaces like wall etc. shot out of focus. The response curve is then smoother and leads to better color rendition in HDR images.
Hope that brings you to even better results ;)
Wolfsauge [deleted] Posted 10 years ago. Edited by Wolfsauge (member) 10 years ago
Thank you all for your comments.

Not yet. I have downloaded cinepaint-0.21-0_rc1.tar.gz but neither compiled nor tested it, yet. Probably a good idea, since it combines the editing possibilties of the old version Gimp with 16-bit deep images.

@Slipping Away (kmhg72):
I was wondering for quite a while. Pfstools seem very improminent and I wanted to change this, too, just by linking to it. It took me a lot of googling and reading time just to find it. On the other hand it is documented very well and once I found it, the results were visible to me very quickly.

Thank you for the correction. Right, it's even said so in the pfstools documentation itself to do so! I added it to part 2., according to your request and placed a link to your flickr identity and a note about your post.

Everybody should read my post not as a tutorial, the pfstools documentation is a way better tutorial than my short writeup, but just as an overview to get started and see some example results. Once you read the pfstools documentation, you'll realize that I just went through the examples in the pfstools README. Nevertheless I'm very happy about corrections and additions, as well as discussion.

Added another note in 3. about pfsclamp, which helped me fix some issues with other pictures I played with.
henrys_rod_shop 10 years ago

I've been having a heck of a time getting anything but super-white, washed out hdr images. I've turned off the auto-white balance, gone full manual, etc on my Canon A510, but still just weird outlines of the lightest parts of the photos.

I also haven't been able to get an EV over 3 at all, out of this camera despite shooting at F8-1/250s...?!

Any suggestions would be greatly appreciated!

Thanks for the great tutorial!

8thcross 10 years ago
good...finally...one of the good to view HDRs...that actually look natural... :)
ashwinmudigonda 10 years ago
HDR with camera shake

Church (HDR)

I feel HDR's work best amidst woods, like this:


I tried a panorama HDR..Didn't workout too well. I find Photomatix a better software tool than PS CS2.
Bob۞Who Posted 10 years ago. Edited by Bob۞Who (member) 10 years ago
I couldn't find the file at ILM. Maybe something with firefox is making the file hide from me...i dunno.

I'll have to study this more...I had difficulty with other links too:

Once I got to sourceforge and found the much dreaded " tar.gz " file extensions. I started getting nausious, dizzy and my eyeballs are spinning backwards in my head!

Then, the command line instructions that you listed above started to give me the shakes and sweats.

Once I get past that code-phobia and clean the drool up I guess I'll give it a whack again, but I sure appreciate those Wonderbread and refined white sugar *.exe files for win32 apps! One double click and yer home free.....the good life! Like frechfries at McDonald's!

Anyway thanks for the efforts, I just need to figure out this "macrobiotic " and "vegan" linux and C++ looking stuff, eventually.

That and clean up the bathroom.

spsilk 6 years ago
For anyone trying to avoid the command line approach, the package Luminance HDR (formerly known as qtpfsgui) provides a GUI for pfstools. You can get it here: qtpfsgui.sourceforge.net/
Groups Beta