Tuesday, July 04, 2006


qpfstmo: HDR Tone Mapping GUI for Linux

Tone Mapping GUI for Linux
I have written a GUI interface to Rafał Mantiuk and Grzegorz Krawczyk's collection of tone mapping operators, pfstmo. They in turn extend the resources in pfstools. My previous post, High Dynamic Range Photography with Linux, outlines methods I use for generating HDRI.

Why Tone Mapping

The first two photos below are the shortest and longest exposures used for constructing the final HDRI. In the upper left image, to capture the sunlit details, the back fence and red chair are underexposed. The upper right image captures faithfully the color information for the chair and fence, along with the displayed image on the computer. But this is at the expense of the brightest parts in direct sunlight completely saturating the camera's sensor. As my earlier post explained, using six images spanning the dynamic range of the scene, a HDR image can be constructed.
Input image
Tone Mapping GUI for Linux, 1/400
f/8 at 1/400 sec
Input image
Tone Mapping GUI for Linux, 1/13
f/8 at 1/13 sec
Tone Mapping GUI for Linux, Linear Range
Linear mapping from HDR to LDR
Tone Mapping GUI for Linux, Log Range
Logarithmically mapped
The reason for Tone Mapping arises when we want to display the resulting HDR image. Most display devices, including monitors and printers are Low Dynamic Range (LDR) devices. We need methods for compressing the range of an HDRI to fit range of our display. The bottom two images show what happens when we try simple methods.

The lower left image tries to linearly map to the 8bits/channel availible in the standard JPG format. Eventhough it maintains strong color information in the midrange, both the high and low end details are completely lost.

The bottom right on the other hand uses a logarithmic mapping, which does a fine job of maintaining the shadow detail. The sunlit parts of the scene also preserve their detail. But this comes at the expense of the color information; the resulting image appears flat.

Tone mapping operators provide more sophisticated methods for acheiving the needed range compression. pfstmo provides seven such operators; along with references to the orginal papers for each operator. For further discussion, I recommend High Dynamic Range Imaging; Acquisition, Display, and Image-Based Lighting by Reinhard, Ward, Pattanaik and Debevec.


qpfstmo provides a Qt-based GUI for using the pfstmo binaries. Before proceeding, make sure you have a working installation of pfstools and pfstmo. Given that, get the source code via:Assuming you got the source code, cd into the source directory and qmake;make to generate the executable qpfstmo. Assuminig you have qt-devel installed, there shouldn't be a problem. The binary doesn't directly link against pfstools or pfstmo; they are used via QProcess.

There is nothing about this code that makes it tied to Linux. If you have Qt and pfstools/pfstmo installed successfully, you should be able to get this program to work.

Overview of using qpfstmo

Assuming you have loaded an HDR image, the first thing to appear is the Main Window.

Tone Mapping GUI for Linux, Main Window

The across the top, there are Tabs for each of the seven operators included in pfstmo. Before any can be used, a "Work Size" must be selected. By starting with a small size, it is quick to see the effect of adjusting a parameter. To apply the selected tone mapping operator with the specified parameters, just press the "Apply", redarrow, button. You can choose to have the new mapped version replace the current image or have the new mapping open in a new viewer window.

Tone Mapping GUI for Linux, Viewer Window

The "Viewer" window. If you like what you see, you can save it. For this version, the only save option is as PNG. I am having issues with Qt's QString and file extentions. Gamma can be adjusted, and reset if needed.

Tone Mapping GUI for Linux, Desktop

Using the "New Window" option in Main window, each tone mapping will appear in its own window. This makes it easy to see what effect adjusting a parameter will have on the tone mapped image.

My favorite tone mapping operators:The top image of this article was tone mapped via the fattal02 operator.

Hi. Thanks for creating qpfstmo. I just found it minutes ago, and it is already running on my fedora core 5 box. A great tool.
Sweet! I had been thinking that I should write a tool similar to this. I was glad to find that someone had beaten me to it. Great work! I've just started playing with it and it's already way better than trying to tweak all those parameters on the command line.
This comment has been removed by a blog administrator.
Well, I was waiting for something like that, so good!! (I wish I would be able to write GUI soft!)
Very interesting!!

By the way, you don't specify the license, I guess it is GPL? (as it is already on sf.net)
Is it planned to add make install so that packaging could be easier?
Maybe you could mentioned that it need qt-3* (with qt-4 it does not compile).
Anyway I already compiled on gentoo, it seems to work fine. It's just still a little bit complicated to fine good parameters.

gentoo reference:
Great Tool - thank you very much.
Like this pfstmo makes really fun - more than using grapic tools on the command line which can be quite frustrating...

As result I always get images with a red touch. Any ideas?
For some reason the viewer shows just a gray image and on command line I get this error:

ImageViewer::setImage:Failure to start

I'm using an openEXR file saved from cinepaint.
When I try to open an HDR photo (exr), I get the error "/usr/local/bin/pfsin: line 6: test: too many arguments". I imagine that is a pfstools error on my end, but I'm not sure. I compiled pfstools without imagemagick support, since I couldn't figure out how to inform it where the libraries are.

Thanks in advance,
Hey, me again.
Just dropping by to say that your program is awesome. Once again, it was a case of PEBKAC. I had to downgrade my ImageMagick(++) install from 9 to 6, and then I could compile pfstools with IM support, and then qpfstmo worked like a charm! Keep up the coding and the cool photos!


I've compiled qpfstools-1.0.0.

When I try to open a file, I get

TMDialog::loadInput:Failure to start

because loadproc->start() is not true in
void TMDialog::loadInput()
"./tm_dialog.ui.h" line 418
The program is still apparently in very _early_ development. On my machine, the image preview doesn't work ("ImageViewer::setImage:Failure to start" error). When will another, more usable version be released?
The "ImageViewer::setImage:Failure to start" is caused by having compiled pfstools without ppm support. On my debian machine installing libnetpbm10-dev and re-configuring and re-making pfstools fixed it.

This is a nice piece of software that actually enables one to experiment with pfstools and stuff. However, it seems desirable to have some sort of save button that will work with the native resolution rather than the work resolution which is usually thumbnail-sized. Of course one can just copy the parameters down and use the command-line tools instead, but it seems like a minor effort to provide that kind of functionality off from the gui itself.


Nice tool, working nicely on debian unstable, may be you could give a push for packaging by completing Makefile with install an uninstall unstructions.
Will back later with some of my search made using psfs suite and qpfstmo. Anyway first works appear very intersting.

B. Rgds



La vie est pleine d'une infinité d'absurdités, qui, impudemment, n'ont
même pas besoin de paraître vraisemblables; car elles sont vraies.

I'd really like to download qpfstmo-1.0.tar.gz, but it is unavailable. Any chance it will be available again soon?
This comment has been removed by a blog administrator.
wrong init values for fattal02 (also wrong in their manpage)
should be alfa=0.01 beta=0.88 saturation=0.8
change in tm_dialog.ui.h
// fattal02
alphaGang = new Gang(alphaSlider, alphaLineEdit, 1e-3, 1, 1e-2, true);
betaGang = new Gang(betaSlider, betaLineEdit, 0.5, 1, .88);
saturation2Gang = new Gang(saturation2Slider, saturation2LineEdit, 0, 1, 0.8);
i do not get a list of available "Work Size"s.
i tried both the .tgz from your homepage and
a CVS-build. both have the same issue. any
ideas how/where to fix that? i'd really love
to test this tool, since it looks pretty cool
(from what i can tell from the screenshots).
br, nos
Hi! I really just wanna thank you for this great app! After hours of sheer misery installing pfstools and pfstmo on Ubuntu, this was a piece of cake... Works great and it really makes experimenting with different settings much easier than just hacking away from the command line.
I put together an rpm for fedora core 6. It can be found at http://www.zacharywhitley.com/linux/rpms/fedora/core/6/i386

What license is it under? If it's GPL can you include a copy of the GPL in the tar? Thanks for the great app.
Hi! Thank you for the article. I found it incidentally. A nice picture caught my eye... Most likely HDR pictures will be my next hobby :)
The reflections on the top of the table in the picture look very nice!
Any chance for an update for pfstmo 1.1? (Some algoritms have been dropped/added/renamed since 1.0).

I didn't know anyone was still using my code. Sure, I'll work on getting a new version out.

I did update it for the new algorithms. Just never got it ready for mass distribution.

Check back.
Hi Nichlas,
thanks for your work,
I'm here just to confirm that there's a problem on my machine with setting the work size = the control doesn't expand.
Well on my free time, I'll try to debug.
Thanks again,
Val (valXdotXhoffmanXatXgmailXdotXcom)
Terrific software - GUI, especially the algorithms, RAW parsing, the lot. Great team work. Nice to see something done so simply, cleanly and professionally. While it may sound stupid, I can't help feeling it has a kind of integrity that's somehow rare in software these days. I'm sure anyone buying a commercial product would get one tone mapping algorithm, without any obvious acknowledgement of the intellectual efforts of the people who designed it. Choice is a wonderful thing. Many thanks.
Thank you so much! for creating qpfstmo, i mean. it is already running on my fedora core 5 box, and i just found it this second! Youre genius!
Nice to see something done so great.

Hi, many thanks for a great piece of software.
BTW: you mentioned back in 2007 you are preparing new version of qpfstmo intended to work with pfstmo 1.1 (new algorhitms etc.). Is qpfstmo 1.0 (available for download in the article) that promised version or not? Thanks
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?