Take the 2-minute tour ×

I am trying to create a SpriteSheet using Photoshop's Scripts>Export layers to files. Thinking about using each layer as a frame. This is what i am doing...

I have a layer with a rectangle in it. I want to duplicate the layer multiple times and in each duplicate, I want to increase the size of the rectangle by 2px.

I create an action with the following steps

  1. Copy the layer with a rectangle
  2. Transform the rectangle in the new layer
  3. Increment the height by 2 px

When I save the action, it stores the height in % rather than pixels which I would need.

If I repeat this action a multiple times, I do not get a smooth transition. Is it possible to increase the height in pixels? Is there a better way to implement this?

Thanks, Amrish

share|improve this question
This questions/answers over at gamedev.SE might be interesting for you: gamedev.stackexchange.com/questions/335/…, gamedev.stackexchange.com/questions/302/… Just export your layers as separate image-files and use a specialized tool to build the sprite-sheet. Probably faster and easier than using Photoshop for that. –  bummzack Mar 21 '11 at 11:02
add comment

4 Answers

up vote 2 down vote accepted

First off: I have no experience with sprites. So I can't really tell if this is the best way to go (overlapping layers and stuff)

You could do this using "Canvas size...".

  • create an image with the smallest dimensions
  • make new layer and fill it with the color of your choice.
  • Now record your actions:

    1. Go to image -> Canvas Size...
    2. Activate the relative option
    3. Change the units to pixels and insert the size increment you want into the height box (in your case width should be "0")
    4. after clicking OK create a new layer
    5. fill it with the bucket
    6. Stop recording. And play the action every time you want to increase the size.
share|improve this answer
add comment

I recently started playing with scripting Photoshop and I took a few minutes to mess with this simple problem as a way to get some practice. While I used VBScript, if you are in any way competent with programming, you could probably port it to applescript or javascript if you need to.

The layer resizing looks like it is, unfortunately, percentage based by design but through scripting it is possible to make the math conversions.

I put the script here: http://ideone.com/F4TL6

In windows, vbscript is a plain text file where you rename it VBS and it will be executable. As always with the internet, if you don't understand what it does, DO NOT RUN IT.

It has no real error checking, so its more a proof of concept. It grabs the first document it sees, and presumes the specially-named layer is transparent except for the rectangle.

share|improve this answer
add comment

See answer to this other question [related]:
automation for repetitive tasks in photoshop?

share|improve this answer
add comment

I've been using Texture Packer to create sprites for my iPhone game. Another great tool is Zwoptex

share|improve this answer
add comment

Your Answer


