Mobile app version of vmapp.org
Login or Join
Merenda852

: Is there an automated, configurable way to organize many layers into a sprite sheet grid with exact pixel coordinates in Photoshop? I have a huge grid of icons that need to be positioned so

@Merenda852

Posted in: #AdobePhotoshop #Grids #ImageSprite #Layers #PhotoshopScripting

I have a huge grid of icons that need to be positioned so that I can write sprites out of them after I'm done.

Right now, I have so many layers, it'd take me forever to click on each one individually and specify the coordinates exactly.

Is there an easy way or a script that allows me to specify in pixels how far apart each icon should be from one another both horizontally and vertically (thereby creating a nice little grid for me with solid values without decimals) ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Merenda852

1 Comments

Sorted by latest first Latest Oldest Best

 

@RJPawlick971

This is a PS script to make Sprite Sheets out of layers. gist.github.com/jessefreeman/870172
// Put this file in Program FilesAdobePhotoshopPresetsScripts
// In PhotoShop menu File > Automate > Scripts: layersToSprite.js

// Arrange layers into a sprite sheet.

if (documents.length > 0)
{

// --------------------------
docRef = activeDocument;
var activeLayer = docRef.activeLayer;

numLayers = docRef.artLayers.length;
var cols = docRef.width;

var spriteX = docRef.width;

// put things in order
app.preferences.rulerUnits = Units.PIXELS;

// resize the canvas
newX = numLayers * spriteX;

docRef.resizeCanvas( newX, docRef.height, AnchorPosition.TOPLEFT );

// move the layers around
for (i=0; i < numLayers; i++)
{
docRef.artLayers[i].visible = 1;

var movX = spriteX*i;

docRef.artLayers[i].translate(movX, 0);

}
}


You may also export all the layers as png images first then zip them and upload to spritegen.website-performance.org/ or any other sprite generator. That will automatically create the sprites for you.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme