HDR Creation Script

A while ago, as I was exploring the world of HDR images and how to create them on Linux, I stumbled across the photoblog of Edu Pérez and was very interested by the workflow he used to create HDR images on Linux.
He even put most of it together in a convenient script. Based on his work, I created my own script to align more closely to my requirements.
For instance, I happen to shoot in JPG sometimes and needed the script to support this format as well as RAW.
To streamline the process even further, I also scripted the Gimp part of the workflow so the script actually generates an XCF file containing 3 layers:

The layer stack in Gimp

  • An exposure blended image produced by enfuse as the background
  •  In HDR image tone-mapped using the mantiuk06 operator in a layer in Soft-Light mode and 50% opacity
  • An HDR image tone-mapped using the fattal02 operator in a layer in Overlay mode

 

The script is invoked from the command-line:

Usage: createHDR.sh [OPTIONS] DIR
-a Align the pictures first
-g{val}    gamma option for RAW conversion (–gamma={val} — DEFAULT=0.45)
-s{val}    saturation option for RAW conversion (–saturation={val} — DEFAULT=1.0)
-e{val}    exposure compensation option for RAW conversion (–exposure={val} — DEFAULT=0.0)
-l{val}    linearity option for RAW conversion (–linearity={val} — DEFAULT=0.10)
-c{path} Configuration file for ufrraw IDFILE.ufraw
-q            Quiet
-k            Display progress information with kdialog
-h            This help

The script will make sure that only one type of file is present in the directory.

If -a is passed as an option, the script will first align the images using align_image_stack command provided by Hugin.

Here are a couple of images produced by this script out of a series of 3 bracketed images:

Nice old town

Promenade des anglais

The latest version of the script can be downloaded from the attachments section at the left of this page !
Update (23 Sept 2009): updated the script to v1.1. See changelog in the script itself.
Update (29 Sept 2009): updated the script to v1.2. See changelog in the script itself.
Update (2 Nov 2009): updated the script to v1.3. See changelog in the script itself.
Update (12 Nov 2009): updated the script to v1.3.1. See changelog in the script itself.
Update (20 Sep 2009): updated the script to v1.4. See changelog in the script itself.
Update (04 Oct 2010): updated the script to v1.4.1. See changelog in the script itself.

If you like this script, feel free to leave a comment !

You can find installation instructions for Ubuntu here and for Fedora here.

How to run the script on several directories

Say you’ve generated dozens of bracketed series and have isolated them in their individual directories using my other script.
You don’t want to have to run the createHDR script manually for each stack !
So I just put together another utility script that will do just that:

Usage: processBrackets.sh [OPTION] DIR
–quiet   -q  Quiet
–kde     -k  Display progress with kdialog

Just make sure sure you have the createHDR.sh script on your path.

Optionally, if you’re running KDE, you can copy the attached .desktop file to the folder services/ServiceMenus of your kde4 install and you’ll end up with a contextual menu when you right mouse click on a folder from your file explorer …
On my machine, the file is /usr/share/kde4/services/ServiceMenus/vinceHDR.desktop

If you run into problems, you can send me an email at photo@tassy.net and I’ll help you out.

CC-GNU GPLThis software is licensed under the CC-GNU GPL version 2.0 or later.

7 Responses to “HDR Creation Script”

  1. Wow! It looks really nice, but unfortunately it doesn’t work on ubuntu 11.10. The script ends with an error at line 117.

    createHDR.sh: 117: Syntax error: “(” unexpected

    Do you have any suggestion how I can fix this? I’m using bash version 4.2.10(1). I’ve installed all the tools that you indicated.

    regards,

    Dirk Boon

  2. I have also a problem at line 117.
    Any glue?

    • Hello Maria,
      could tell me what is the error you’re getting ?
      Also what Linux distribution are you using ?
      You can mail me directly at photo@tassy.net

    • Hello Maria,

      I’m guessing you’re running the script with sh and not bash and that this is what causes the error …

      so either run: bash createHDR.sh myfolder

      or, what I do, make the script executable (chmod 755 createHDR.sh) and then run it as ./createHDR.sh -a myfolder

      note it is a point slash prior to the name.

      The first line in the script indicates that it should be run using bash rather than sh so runnin it this way will take care of it … also, this way you can move the createHDR.sh file to /usr/bin and this way you can call it from anywhere just by running: createHDR.sh -a myfolder

      Let me know if it fixed your problem !

  3. Dear Vincent

    Really great scripts and quite useful. I hope I can get it working on my Ubuntu (11.10) box! I get the following error massage when I run your script, would you have any clue why:

    ‘tif files unsupported. Compile pfstools with ImageMagick or libtiff’

    I looked up pfstools website and help but there is no clear instruction on how to complile pfstools with ImageMagick or libtiff. Any help will be greatly appreciated.

    Best wishes and thanks
    Moe

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 The Linux Darkroom Suffusion theme by Sayontan Sinha