Automating your work with Actions
This tutorial requires basic knowledge of Adobe Photoshop.
So, you’ve been using Photoshop for quite some time, be it for designing user interfaces or any other of its numerous purposes. Once you get the hang of it, certain tasks may become monotonous, tedious even. I mean, how many times a day can you downscale an image to half its size before your fingers start to hurt?
Luckily, Adobe comes to our rescue once again, with a nifty feature called
Actions. An action is basically a sequence of steps which Photoshop can perform automatically, with just one hit of a mouse button (or a keyboard shortcut). It can be short, like simply adding a background to your file, or long and complex, whatever you need at the moment.
There is a bazillion of different actions available for free download in the magical kingdom of Internet, but often you will be in need of one tailored to your special needs. In this tutorial, we will show you how to create your own actions, edit them, and apply them to multiple files at once. Let’s get started!
We’ll begin by choosing an often-used feature and creating an action for it. A great example would be the aforementioned background layer we want to add to the image. There is a menu option that allows you to do it, but you either have to spend valuable seconds of your time choosing
Layer > New > Background From Layer each time, or assign a long and difficult to remember keyboard shortcut to it (all the good ones are already taken). We will create an action that will allow you to do it with just one click.
You have to have a file open that doesn’t have a background layer. Open the Actions panel (
Window > Actions or
Alt+F9). You will see default Photoshop actions, and some options in the bottom part of the panel. Click the
New icon (see below):
A menu will appear, prompting you to name your action and choose the icon set it will belong to (we’ll leave it at
Default Actions for now). You can also assign a keyboard shortcut to it, but it’s not required. Let’s call our action
Add Background and click the
You can see that the red “Record” icon is now highlighted. This means that whatever you do now (in Photoshop, of course) will be saved as a step and reproduced later, when the action is called.
Now is the time to add a background. First, let’s create a new layer and fill it with white (or other color of our choice). Click
Layer > New Fill Layer > Solid Color and select a color from the palette. You may have noticed that in the Actions panel, the
Add Background action is no longer empty, but your latest operation appeared as a step:
Layer > New > Background From Layer and the white layer we’d created will be automatically converted into a background. These are all the steps we need for this action, so now is the time to press
Stop to - you guessed it - stop recording.
Let’s test our action! Open any file that has no background (or revert the one you’ve been working on to its original state) and try pressing
Play in the Actions panel to see what happens. (If you try to apply it to a file that already has a background, you will get the popup informing you that your action is impossible to execute, that’s all).
Great success! We already know how to create actions. Now let’s say we forgot to add one more step to the “Add Background” action we had created: we want to flatten the whole image into one layer. We don’t need to create another action for that - we can just edit the existing one. Here’s how:
Select the action you want to modify in the Actions panel, and click the
Record button. It will turn red again - this means you can now add steps to your action. Choose
Layer > Flatten Image (it will only be available if you have more than one layer), then click the
Stop button. Your action has three steps now instead of two.
You can also modify existing steps. Try it - double click any of the steps to edit its parameters and save them into your action.
When an action is no longer needed, there’s nothing simpler than to delete it: just select it and click the
Delete button in the Actions panel:
Bonus trick: if you want to omit one or more steps, but not delete them from the action, just click the checkmarks to their left. The checkmark for the whole action will turn red, indicating a modified state. To return the action to default, click the checkmark next to its name and it will be reset.
Now that we know how to create our own actions, let’s add a new action set to separate our custom ones from the default Photoshop set. See the folder icon at the bottom of the Actions panel? Click it, type in a name, and you’re all set (pardon the bad pun).
If you want to move the action created earlier from one set to another, it’s a piece of cake: just click and drag it. Simple as that.
Now comes the fun part. There are times when you have a hundred files to process (resize, add background, you name it), and no source PSD, so you can’t benefit from the handy Generator tool we covered in last week’s blog post. Here’s where the batch processing option comes to play.
We created a short animation of a spinner and exported it into a PNG sequence. Let’s say we would like to add an outer glow effect to each of the animation frames. Even if we had an action for it, opening, editing and saving each file would soon bore us to death. Instead, we will automate the process so that everything will be done in a few clicks.
First, we need an action that adds the outer glow. You can use the one we provided in the files for this tutorial, edit it as you please, or create your own. Just remember to add a
Rasterize Layer Style step at the end of your sequence.
Now go to
File > Automate > Batch; a settings panel should appear:
First, we choose the action we want Photoshop to perform (usually the last action created or used is the default choice). Hint: if you don’t see your action in the list, make sure you’ve selected the right action set.
Now we decide which files to process and where to save them. Click “Source: Folder” and then “Choose…” to select the directory. Then in “Destination” select “Save and Close” - this will overwrite the files. If you want to keep the original files, choose “Folder” in the dropdown menu and specify the directory you want the processed images to go in.
Now all that’s left is to click “OK” and watch the magic happen.
What we covered in our little tutorial is just the tip of the iceberg. You will find that with actions your work can become a lot less tiring, and the multitude of options will cater to everyone’s needs. Here are some examples of things that can be automated with Photoshop:
- creating smaller assets (for lower screen densities) - useful when you forgot to properly name your layers for Generator to process;
- creating a background for a file (covered in the tutorial);
- trimming transparent pixels;
- applying often used effects like Gaussian Blur or Drop Shadow;
- adding UI elements like the navigation bar to the file, or even creating templates;
- changing the file dimensions to a popular screen size, e.g. an iPhone 6;
- and many more!
We prepared a little action set for you to play with; it is available for download along with the files used in this tutorial. To install the set, click the drop-down menu in the Actions panel, select “Load Actions” and choose the directory you unpacked them into.
Do you know cool tips and tricks for Actions that we haven’t covered here? If you have any comments about automating your work in Adobe Photoshop, feel free to share them with us below.