Created
January 20, 2011 14:25
-
-
Save timvisher/787954 to your computer and use it in GitHub Desktop.
Script to scale and crop a bunch of wallpapers selected in Finder.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" to set wallpapers to selection | |
tell application "Image Events" | |
repeat with currentWallpaper in wallpapers | |
set theWallpaper to open (currentWallpaper as alias) | |
tell theWallpaper | |
repeat with dim in [{1920, 1080}, {1280, 800}] | |
-- Scale and Crop to current dimensions | |
scale to size (get item 1 of dim) | |
crop to dimensions dim | |
-- Set up save target | |
set namePrefix to text items 1 thru ((offset of "." in (get name)) - 1) of (get name) as string | |
tell application "Finder" | |
set _ to parent of currentWallpaper as alias | |
set parentPath to POSIX path of _ | |
end tell | |
set saveTarget to parentPath & namePrefix & "_" & (get item 1 of dim) & "x" & (get item 2 of dim) & ".jpg" | |
--save to target | |
save in saveTarget as JPEG | |
end repeat | |
end tell | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment