In a previous blog entry (Linux script to generate HDR images from bracketed images) I delivered a script to help creating HDR images out of a series of bracketed images.
But I then found myself facing another problem ... On my last vacation, I returned home with about 1500 images out of which maybe 300 where bracketed images ...
To use my tool, I would have had to manually create roughly 100 directories and figure out the series of 3 images that belonged together to isolate them in those folders ...
Instead of spending hours doing so, I decided to spend one hour writing a script that would automate this task.
So here it is !
Usage: sortBracketed.sh [OPTION] DIRThe script will run two passes. One for JPG files, one for CR2 files.
--quiet -q Quiet
--verbose -v Verbose
--dry-run -d Analyze but don't actually move the files
It checks the images three by three to make sure the numbering is continuous, that the exposure mode is bracketed and that the three images belong together because the progression of the exposure bias is consistent (0 -2 +2, -1 -2 0, etc)
When such image series are found, the script will create a sub-directory HDRx (where x is a number that is incremented automatically) and move the images there.
here's a simple example of a run:
And voilà ! I end up with a folder HDR1 containing 3 images I can use to build an HDR image.
Analyzing JPG files
Checking if file IMG_0003.JPG is bracketed ... NO
Checking if file IMG_0004.JPG is bracketed ... NO
Checking if file IMG_0005.JPG is bracketed ... NO
Checking if file IMG_0050.JPG is bracketed ... YES
Checking if file IMG_0051.JPG is bracketed ... YES
Checking if file IMG_0052.JPG is bracketed ... YES
Checking if file IMG_0053.JPG is bracketed ... YES
4 bracketed images found
Checking if images 0050 0051 0052 go together ... NO
Checking if images 0051 0052 0053 go together ... YES
IMG_0051.JPG \
IMG_0052.JPG |> HDR1 - Exposures: -1.5 0 1.5
IMG_0053.JPG /
Analyzing CR2 files
0 bracketed images found
This is the default verbosity of the output. If you pass -q as a parameter, it will be totally silent. If you pass -v, it will be even more chatty ;-)
I show here a simple example but I actually used the script on my vacation pictures and it created 93 folders and perfectly identified the series of 3 images ! Yeah me !
If you don't trust the script will work on your images, you can invoke the -d option so it will only output the information but will not create folders and move files.
You can download the script here:

sortBracketed.sh
5k
Update (29 Sept 2009): updated the script to v1.1. See changelog in the script itself.
Update (19 Mar 2010): updated the script to v1.2. See changelog in the script itself.
Update (19 Mar 2010): updated the script to v1.2. See changelog in the script itself.









