Antoine's solution

Here's my approach to your challenge.

I use python's multiprocessing module to be able to control the number of processes running (use all cores of cpu). First of all, this requires to transform the file objects into file-like objects that are passed to the child processes as file descriptors cannot be passed this way.

Also, as this is being benchmarked, speed is of the essence. Instead of simply creating a single process per image, the solution uses a thread safe queue to break-up tasks for each image. As soon as a task is finished on an image it can pass to another task on the same or another image depending on what's next in the queue. 

On my laptop (i5-4300U with 4 cores), I get times of about 6sec for each axis on the 7 pictures provided.

You can choose on the command line what axis should be processed with the -t parameter (accepts : x, y or both). Files are outputed to 'processed_images' sub directory with naming nomenclature as specified.

Comments for specific points are within the code.

http://legacy.python.org/dev/peps/pep-0008/#maximum-line-length