I need some image programming advice

I am trying to build a high resolution image that consist of vertical lines from other images.

To be exact: I want to build an image that is 3888×2592 pixels. I want to build it using 3888 vertical lines that are 2592 pixels high. I have a folder with 3888 high resolution images and the new image should be build by extracting vertical line number one from the first picture, vertical line number two from the second picture, vertical line number three from the third picture and so on.

Here is a very simple illustration:
Click illustration to enlarge.

It would be possible to do this manually in photoshop. Open one image, cut the first column of pixels, paste in a new image and repeat 3888 times… But this is something that would be much easier by automation. Pseudo code:

- Create new image, 3888×2592

For n = 1 to 3888
- Open image number n
- Copy column number n (1×2592 pixels)
- Paste at column number n in new image
Next n

…the problem is that I have no idea what tool to use. Could this be programmed using automator and apple script? Using automation in photoshop? Or do I need to learn xcode and do it the hard way?

Preferably a solution that could be done on a Mac.

Any advice is appreciated!