Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Photoshop CS5 script for making sprites out of a pile of layers :D Assumes that the top layer is the first frame, bottom is the last. Based on this one: http://www.garagegames.com/community/blogs/view/11527 I just like my sprites to run vertically. I'm weird like that.
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, spriteY * rows, AnchorPosition.BOTTOMLEFT );
for (i=0;i < numLayers ;i++)
{
docRef.artLayers[i].visible = true;
var movY = spriteY*i;
docRef.artLayers[i].translate(0, -movY);
}
}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