Basicly, I need to sort a bunch of jpegs based on the files width x height to seperate all the 4:3 Desktop Picture sized photos into one folder and the rest leave them there or into a second folder. How would I go about doing this? I figure that I would need to:
-
call sips from the applescript (as “sips -g pixelWidth -g pixelHeight {file x}”)
-
parse the pixelWidth and pixelHeight lines (When I run it, I always get :
Chaos@tic:~/pic/ sips -g pixelWidth -g pixelHeight 002.jpg 003.jpg 005.jpg
/Users/Geo/pic/002.jpg
## Component Manager: attempting to find symbols in a component alias of type (imdc/MP42/MSFT)
pixelWidth: 1002
pixelHeight: 666
/Users/Geo/pic/003.jpg
pixelWidth: 669
pixelHeight: 1002
/Users/Geo/pic/005.jpg
pixelWidth: 512
pixelHeight: 768
With this error “## Component Manager: attempting to find symbols in a component alias of type (imdc/MP42/MSFT)” on the second line, regardless of how many files I give it.)
-
Make sure that Width is greater then Height
-
a) If width is greater then Height, then compare width over height to 4 over 3 (Compare Ratios)
-
b) if width is less then height move file to folder1
-
a) If Ratios match, move to folder2
-
b) if ratios do not match, move to folder1 (Or a Third Folder)
-
Repeat till folder is done.
I know I would also need to check it see if Folder1,2,and 3 exist within the main folder, and if not, create them. Also needs to not overwrite a picture, if duplicate name is in a folder, add .1 or .2 or .n to the end of the file name.
Finally, this isn’t required, but if there could be a tolerence built into the ratio checking.
Any and all help would be appreciated. Instruction rather then the answer would be even moreso appreciated