Using AppleScript to Programmatically Crop Images
Create the following AppleScript using the AppleScript Editor
on run argv set the this_file to item 1 of argv set the vertical_crop to 20 set the horizontal_crop to 30 tell application "Image Events" launch set this_image to open this_file copy dimensions of this_image to {W, H} crop this_image to dimensions {W - horizontal_crop, H - vertical_crop} save this_image with icon close this_image end tell end run |
Compile and save the file as a script.
Now you are ready to run the script on your images:
naresh$ osascript crop_image.scpt /complete/path/to/image.ext |
Results:
Before | After |
---|---|