Skip to content

Instantly share code, notes, and snippets.

@bricklife
Created October 30, 2015 07:35
Show Gist options
  • Save bricklife/e227d537c3738f4dec81 to your computer and use it in GitHub Desktop.
Save bricklife/e227d537c3738f4dec81 to your computer and use it in GitHub Desktop.
Resize Screen Shots
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