Created
October 30, 2015 07:35
-
-
Save bricklife/e227d537c3738f4dec81 to your computer and use it in GitHub Desktop.
Resize Screen Shots
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
var onRun = function(context) { | |
var selectedLayers = context.selection | |
var selectedCount = selectedLayers.count() | |
for (var i = 0; i < selectedCount; i++) { | |
var layer = selectedLayers[i] | |
if (typeof(layer.NSImage) == 'undefined') { | |
continue | |
} | |
var frame = layer.frame() | |
var originalSize = layer.NSImage().size() | |
layer.constrainProportions = false | |
if (originalSize.width == 1242 && originalSize.height == 2208) { | |
frame.width = originalSize.width / 3 | |
frame.height = originalSize.height / 3 | |
} else if (originalSize.width > 320) { | |
frame.width = originalSize.width / 2 | |
frame.height = originalSize.height / 2 | |
} else { | |
frame.width = originalSize.width | |
frame.height = originalSize.height | |
} | |
layer.constrainProportions = true | |
frame.x = i * 100 | |
frame.y = 0 | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment