Sorting 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 !
The script will run three passes. One for JPG files, one for Canon CR2 files and one for Nikon NEF 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:
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
Analyzing NEF files
0 bracketed images found
And voilà ! you end up with a folder HDR1 containing 3 images I can use to build an HDR image.
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 😉
If you have KDE installed on your system, you can use the -k option to have a graphical dialog showing progress.
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.
The latest version of the script can be downloaded from the attachments section at the left of this page !
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 (11 Aug 2010): updated the script to v1.3. See changelog in the script itself.
Update (20 Sep 2010): updated the script to v1.4. See changelog in the script itself.
Update (11 Nov 2010): updated the script to v1.5. See changelog in the script itself.
Update (06 Dec 2010): updated the script to v1.5.1. See changelog in the script itself.
Update (16 May 2011): updated the script to v1.5.2. See changelog in the script itself.
Update (06 Jun 2011): updated the script to v1.5.3. See changelog in the script itself.
If you like this script, feel free to leave a comment !
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/vinceBrackets.desktop
If you run into problems or the script currently doesn’t support your camera’s files, you can send me an email at photo@tassy.net and I’ll help you out.
Great scripts!
I modified this one to match the string for a US model 400d (it’s labeled as Canon EOS DIGITAL REBEL XTi), but I’m running into a syntax issue on line 117 with Fedora 17:
Here’s a snippet:
Camera make: Canon Camera model: Canon EOS DIGITAL REBEL XTi
Checking if file IMG_6573.JPG is bracketed … YES
Camera make: Canon Camera model: Canon EOS DIGITAL REBEL XTi
Checking if file IMG_6574.JPG is bracketed … NO
10 bracketed images found
Checking if images 6540 6541 6542 go together … (standard_in) 1: syntax error
/home/jake/bin/sortBracketed: line 117: [: =: unary operator expected
NO
Checking if images 6541 6542 6543 go together … (standard_in) 1: syntax error
/home/jake/bin/sortBracketed: line 117: [: =: unary operator expected
NO
Any thoughts?
Hello Jake,
I’ve got a Canon EOS 100D (EU Version) and I’ve just make some modification to the script. Please send me your file to try with my new version of the script. I think, the bug appear when he try to check the value of Bracketing (Wrong Metadata label).
See ya !
Hello,
First of all great script. I had the same issue and was thinking, I’m properly not the only one. I modified /changed the script so it works for my Sony A6700.
How can I best share the changes? Mail to Vincent Tassy ??
Thanks!