|
|
An AppleScript to resize the longest side of an image
I think is better not to use Photoshop to do the resize when you have "Image Events" in the Mac Os X.
Here is a variation on the code found here (http://schinckel.net/2006/03/04/resizing-images-in-applescriptautomator/) but to handdle multiple files: --------------------------------------------------- global theImage tell application "Finder" set sels to selection end tell set theResult to display dialog "Select the short side size." default answer "450" set theAnswer to text returned of theResult -- Retrieve the resize percentage amount set theNewWidth to theAnswer as integer repeat with sel in sels set theImage to sel as alias tell application "Finder" set theImageName to name of theImage as string set theImageFolder to (folder of theImage) as string end tell set theResizedImagePath to theImageFolder & theImageName & "_RESIZED" as string tell application "Image Events" launch set theImage to open theImage -- This is the tricky part: you need to keep the ratio of the original picture copy dimensions of theImage to {currentWidth, currentHeight} set ratio to theNewWidth / currentWidth tell theImage scale by factor ratio to size theNewWidth save in theResizedImagePath close end tell end tell end repeat --------------------------------------------------- |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.29 seconds |
|