Well, that was simple! One thing that I love about Linux is there’s always a easy way to something. Here’s an example; to create a load of RAW images into HDR versions in Linux, I have to:
That’s per image. While each program has some form of Batch mode, they don’t talk to each other at all, so it’s a case of either processing each image in turn, or all creating of the TIFs, then loading them into Photomatix, then batch processing the tweaks in Photoshop. While the end result is excellent, it’s a very time consuming process.
Here’s how I make a HDR image in Linux
make_hdr CRW_4132.CRWCRW_4132.CRW is the name of the RAW straight-from the camera image. I wait a little while, and it spits out a file called CRW_4132.jpg, which is a perfect, HDR tone-mapped jpg. If I want to process a whole directory of RAW images, I can type for i in *.CRW; do make_hdr $i; done. That’ll take all of the RAW images in the directory, and give me back my HDR tone-mapped jpegs.
I’ve said it before, I’ll say it again; Damn, I love Linux!
Here’s how I did this……..
pfstools is the heart of the magic; it’s a set of command-line tools which will make High-Dynamic Range images from pretty much any source, including a single RAW file. So more need to create all those darned TIFs!
Download it, then configure, make and make install as root.
pfstmo is the part of pfstools that generates the tone map. We need that.
Important! Copy /usr/local/lib/pkgconfig/pfs.pc to /usr/lib/pkgconfig otherwise the configure script can’t find the pfs libraries you’ve just installed. It’ll save you headaches, promise!
As before, download the source, then configure, make and make install as root.
The last two parts of the equation are ImageMagick and a small bash script while automates the whole process. Image Magick is one of the most powerful image manipulation tools out there. It’s also 100% command-line driven. If you can get your head around using something from the command-line to manipulate photos, it’s one of the most useful pieces of equipment in a Linux photographer’s toolkit, and well worth the time spent to learn it.
You’re likely to have ImageMagick already installed on your Linux system as it’s standard on pretty much every distribution out there. If not, install it using your favourite package manager.
Here’s the script. Copy and paste this into a file called make_hdr and drop it into /usr/local/bin:
#!/usr/bin/bash
ARGS=1
E_BADARGS=65
E_NOFILE=66
if [ $# -ne $ARGS ] # Correct number of arguments passed to script?
then
echo "Usage: `basename $0` filename"
exit $E_BADARGS
fi
if [ -f "$1" ] # Check if file exists.
then
filename=$1
basename=${filename%.*}
pfsindcraw $1 | pfsclamp --rgb | pfstmo_drago03 | pfsout $basename.jpg
convert -normalize $basename.jpg $basename.jpg
echo "$basename.jpg created!"
else
echo "File \"$1\" does not exist."
exit $E_NOFILE
fiMost of this script is taken up with making sure you’ve passed it a valid filename. The main meat is these two lines:
pfsindcraw $1 | pfsclamp --rgb | pfstmo_drago03 | pfsout $basename.jpg convert -normalize $basename.jpg $basename.jpg
The first takes the RAW file, turns it into a HDR, tone maps it and kicks out a jpeg. (wow!)
The second just auto-levels the images to bring the colours back into something like a realistic range. If you want to apply any other effects to all your images such as sharpening, boosting saturation or resizing them, this is the line to fiddle with. Take a look at ImageMagick's Examples pages to see what’s possible.
Now for a confession. When I started looking to see if it’s possible to generate HDR images under Linux. I wasn’t hopeful. I suspected that this would be one area where I’d still have to rely on Windows to provide the tools I needed. the reality is it’s not only possible, it’s actually better supported under Linux than Windows, with a wide range of tools and applications out there to make HDR images. I guess the moral of this tale is never underestimate Linux, or assume you can’t do something.
To put it another way: When the source is open, all things are possible!