Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // K Baker @ 14.01.2014 11:21:01
- // Resize canvas to largest size in Photoshop
- // Tested only in Photoshop CC on Maverics
- // Enable double clicking from the Macintosh Finder or the Windows Explorer
- #target photoshop
- // If double clicked, bring app to front
- app.bringToFront();
- if (documents.length > 0) {
- // Get original height and width
- originalWidth = app.activeDocument.width;
- originalHeight = app.activeDocument.height;
- // Resize canvas to the largest size
- if (originalWidth > originalHeight) {
- newWidth = originalWidth;
- newHeight = originalWidth;
- } else if (originalHeight > originalWidth) {
- newWidth = originalHeight;
- newHeight = originalHeight;
- } else {
- // There's really nothing to do here, as the height and width aparently are the same size
- }
- app.activeDocument.resizeCanvas(newWidth, newHeight, AnchorPosition.MIDDLECENTER);
- } else {
- alert("You must have at least one open document to run this script!");
- }
- // EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement