I am working on a game that uses an animation software called Spine to create the character animations. Spine allows you to create skeletal animations by attaching PNGs to bones & then moving the bones on a timeline by key-framing position, scale, rotation, etc. For the game graphics to look sharp, we need to make sure each of the PNGs are divisible by a certain number ratio.
So with that in mind, I'm trying to create a PS Script that will export each layer out as a PNG but check for the following:
- If the layer's dimensions are not divisible by 16, add on pixels evenly to the height & width to make the dimensions divisible by 16. Then export as a PNG.
- If the layer's dimensions are already divisible by 16, export out a PNG as normal.
Some kind guys helped me with a piece of code that adds on pixels to a canvas to make it divisible by 16 but I'd like to make the code more dynamic by it looking at layers & bypassing the script if the layer is already divisible by 16:
preferences.rulerUnits = Units.PIXELS; with(activeDocument)
resizeCanvas(width + 16 - width % 16, height + 16 - height % 16)
Any help with this problem would be greatly appreciated, i'm a humble animator and this is way over my head! Kind Regards, Steve.