I apologize for the very specific set of circumstances, I don't know how helpful a solution would be to others. I'm looking for an automation solution for a image fetching and stitching task. I have images from a web source, that are stored in regularly incrementing folders, and with predictable file names. I would like to download these files, deposit them in folders based on their originating folders, and finally, stitch the files in each folder together in a simple grid.
Here are the specifics of the two steps.
Step 1
The images are stored in regular incrementing named folders in this format.
http://website.url/XX_[1-339][v/r]/XX/images.jpg
So the numbers will increment from 001 to 339 and each number will have a 'r' and 'v' version, so for example.
//XX_256r/XX/images.jpg or //XX_075v/XX/images.jpg
These URLs are otherwise always the same. Now within the folder themselves the contents are images broken into 131 256x256 .jpg's. These files are also highly regular and named according to a grid pattern, as [0-9]_[0-12].jpg, with the first image being 0_0.jpg and the last being 9_12.jpg.
I have been able to download these files folder by folder without difficulty by using a simple applescript. However it's still a bit involved to do this ~600 times. The next step is the part I have not been able to figure out even a one-off automated solution for.
Step 2
The images exist in their own folders, and the images themselves are a single larger images broken into 256x256 pixel sections. What I want to do next is simply assemble these images into a grid. The images are named for their position in the grid, so 0_0.jpg begins at the top left, and 1_0.jpg is the next position over. The grid is 9 spaces wide and 12 tall, so the first row of images will increment from 0_0.jpg to 9_0.jpg and the last row will be 0_12.jpg to 9_12.jpg. I'd like to automate the stitching of these images into a single image, so that it can be batch applied to the entire collection.
This is my goal. For this I have X questions:
If I'm running OS X, can I perform the first step with a script in the Automator? I was able to fetch a single folder with a simple
curl -O http://website.url/.../XX/[0-9]_[0-12].jpg
But I can't figure out how to create a script that will deposit images into folders based on their originating folder. So for example I can
curl -O http://website.url/XX_[001-339]v/XX/[0-9]_[0-12].jpg
Running it once with a v suffix and once with an r to fetch every images, however that will place a few hundred identically named files in the same folder. I'm not sure how to divide them up.
- Once I have all the images in their respectively named folders, how can I stitch them together? Since no image processing or modification needs to be done, this seems like it should be a feasible task through some kind of scripting, but as a total novice I've no idea where to start. 131 images have to be assembled into a JPG and this process needs to be repeated 680 times, so automation is desirable.
Any advice on where to begin would be greatly appreciated, I realize this is a pretty specific problem.