Created
August 9, 2012 18:28
-
-
Save psql/3306838 to your computer and use it in GitHub Desktop.
Photoshop layer stack to horizontal sprite
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
if (documents.length > 0) | |
{ | |
var docRef = activeDocument; | |
var activeLayer = docRef.activeLayer; | |
numLayers = docRef.artLayers.length; | |
var rows = numLayers; | |
var spriteX = docRef.width; | |
var spriteY = docRef.height; | |
app.preferences.rulerUnits = Units.PIXELS; | |
docRef.resizeCanvas( spriteX * rows, spriteY, AnchorPosition.TOPLEFT ); | |
for (i=0;i < numLayers ;i++) | |
{ | |
docRef.artLayers[i].visible = true; | |
var movX = spriteX*i; | |
docRef.artLayers[i].translate(movX, 0); | |
} | |
}else | |
{ | |
msg("Sorry must have more than 1 image open in photoshop to work!"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stripped this out of something I found a long time ago. Trying to work out how to stack vertically instead.