Skip to content

Instantly share code, notes, and snippets.

@troutcolor
Created July 9, 2015 19:24
Show Gist options
  • Save troutcolor/995ee2e9c06bc519642e to your computer and use it in GitHub Desktop.
Save troutcolor/995ee2e9c06bc519642e to your computer and use it in GitHub Desktop.
resize images selected in finder (I use in Fast Scripts)
tell application "Finder"
set files_ to selection
set w to the text returned of (display dialog "What width?" default answer "500")
repeat with file_ in files_
repeat 1 times
--set imgkind to (kind of file_)
--if (imgkind does not contain "Image") then
-- exit repeat -- 1 times
--end if
--set ex to name extension of file_
--set fname to "440_" & name of file_
set file_ to quoted form of POSIX path of (file_ as string)
--set outfile to choose file name with prompt "save resize file as:" default name fname
--set outfile to quoted form of POSIX path of outfile
do shell script "sips --resampleWidth " & w & " " & file_
--& " --out " & outfile
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment