I took a bunch of night-time photos not long ago, and wanted to stack and average them to improve the SNR. After much experimenting and asking here on the forums, I’ve finally put together a batch script that will take a folder full of RAW photos and output a 16-bit tiff ready for further editing in GIMP or RAWTherapee.
There’s a lot more I could do here, but this is just a very basic script that I can tweak to my liking. It is possible with the first option to have RAWTherapee read a .PP3 file and make adjustments to the RAW file before converting it to .tif
Obviously if you want to copy this script for your own use, you’ll have to change filenames and executable paths to match your system, but this should work pretty much out of the box otherwise!
Of course you’ll need to have all of the necessary software installed.
RAWTherapee
align_image_stack (from Hugin)
G’MIC
Exiftool
(Alternatively you could use dcraw for RAW conversion, and ImageMagick for averaging)
I registered the executables needed by following this answer on stackoverflow. That way I don’t have to type the path to the executable every time I want to call it!
If you have any suggestions for improvement, please speak up! I’ve already learned a lot, but I’m definitely open to learning more!
If you want it be more flexible in the future may I suggest using AutoIt then.
it’s almost as simple as batch script but you have far more options and control this way and you even could compile such scripts into an EXE in the end.
Well AutoIt isn’t open source, it does not cost, except you want to donate. It’s out there for quite a while and used by a wide win user base today.
If possible, use command-line options in the order specified in the --help, /?, man page or docs. This just makes it easier to look them up. Also a general tip though not applicable here, use the long form of the options, as this makes it easier for others to figure out what you did, or for yourself a year from now.
e.g. use --make-more-awesome instead of -a.
Replace those paths with constants defined at the top of the script file, in a “user section”. e.g.: rt="C:\Program Files\RawTherapee-4.2.539\rawtherapee.exe"
(…) rt -b16 -t -w -c IMG*.PEF (or whatever works in Windows)
Good suggestion, I never thought about using software like that for something like this!
Thank you @paperdigits, I’ve heard of AHK, and tried it briefly, but never really had any need for it.
@Morgan_Hardwood Wow, thanks for all the tips! That’s very good to know!
I have heard about using CLI options “in order”, but I never knew how to identify that order!
Thanks for the tip on constants too, that’s very useful! After a little online searching I found that for Windows in a batch script, the code is:
%rt% -b16 -t -w -c EJM*.PEF ````
* I presume the commands you posted there for metadata copying are for Linux? Are there any equivalents for Windows?
* Got it, thanks!
* So I've been writing it wrong all this time! :frowning: I'm almost positive that I learned it correctly! Did it change, or was I deluded all this time? :slight_smile:
If order is important, the documentation should explain that. If it doesn’t, then the order most likely doesn’t matter, but it would make reading the script easier if in that case you went by the same order that the commands are explained in the docs.
The only thing that would change for Windows in those ExifTool examples is replacing exiftool with exiftool.exe or whatever the executable in Windows is called.