I've made some changes to allow input and output filenames to be passed on the command line. All values default to those in the original code and so these changes shouldn't break anything however they do let me run the code from a shell script over a directory containing many images #3