Using Actions to Automate Tasks in Photoshop
While Adobe Photoshop has a host of automation tools, one of the most versatile and powerful of them is called an action. In fact, some of the other automation commands, such as batches and droplets, derive their functionality from actions.
An action is like a macro or script; however, while scripts have a reputation for being confusing and difficult, actions are very easy to create. If you know how to use Photoshop, you know most of what you need to create your own actions.
For example, let's say that you have 100 digital photos that you'd like to post on the Internet. Normally, you'd have to load each one, scale, color correct, sharpen, and then save them one at a time. Alternatively, you could create an action that does all the "dirty work" for you — and best of all, you'll get consistent results in far less time than you could've achieved by doing it manually!
Although actions can be used to automate all sorts of tasks, some common uses include:
- batch-processing multiple images;
- applying consistent treatments;
- repeating tedious or mundane tasks; or
- distributing reproducible special effects.
To better understand actions, let's begin with a comprehensive overview of the Actions panel, including the commands available in the Actions panel menu. We'll then use these commands to create a couple of actions of our very own!
Introduction to the Actions Panel
The Actions panel is sort of like a "mini action editor": it allows you to create (record), edit, load, save, delete and play actions (among other things). To show or hide the Actions panel, use the Window » Show Actions command or press the F9 key. The figure below shows the Actions panel in List View Mode (its default mode).
Click on each of the letters below to see the corresponding descriptions.
A. Stop Playing/Recording
The Stop button () stops action playback and recording. This button is equivalent to pressing Esc or Ctrl/Cmd+.. You can also stop recording by choosing Stop Recording from the Actions panel menu ().
B. Begin Recording
Push the Record button () to begin recording a new action or to add additional commands to an existing action. If an action itself is selected, new commands are appended to the end of the action. If an action step is selected, new commands are inserted after the current action step. You may also begin recording by choosing Start Recording from the panel menu.
Note: You may rerecord the parameters for a command by double-clicking on its associated action step. If available, the command dialog will appear allowing you to enter new values. Choose OK to apply the new settings or Cancel to leave the original settings.
C. Play Selection
If an action is selected, pushing the Play button () plays the entire action. If an action step is chosen, the action will begin playback from the currently selected command. You may also choose Play from the Actions panel menu.
D. Create New Set
Press the Create New Set button () to create a new action set. A dialog will appear, prompting you for the set's name. This button is equivalent to choosing New Set from the Actions panel menu.
E. Create New Action
Press the Create New Action button () to add a new action to the selected set. A dialog will appear, prompting for the action's name, associated set, keyboard shortcut and Button Mode color. This button is equivalent to choosing the New Action command from the Actions panel menu.
As you might expect, the Delete button () deletes the selected set, action or command. A dialog appears to confirm your intentions. Alternatively, you may access the Delete command from the panel menu.
Delete operations performed in the Actions panel are not added to the history, nor can they be undone via the Edit » Undo command; however, you may undo/redo the last delete operation by pressing Ctrl/Cmd+Z.
G. Action Sets
Sets behave much like folders, in that they allow you to organize your actions. Double-click on a set (or choose Set Options from the panel menu) to change its name.
An action is basically a Photoshop macro containing one or more pre-recorded commands that may be replayed on another image (or series of images). Actions can only exist within a set (i.e., they can't be created in the Actions panel outside of a set). Double-click on an action (or choose Action Options from the panel menu) to change its name, keyboard shortcut and Button Mode color.
I. Action Steps (Commands)
Action steps are pre-recorded Photoshop commands. Actions are comprised of one or more action steps.
J. Command Details
Expanding an action step (by clicking on its associated disclosure icon, ) reveals the details/values that were set for the command at the time it was recorded.
Note: You may change the parameters for a command by double-clicking on its associated action step (or by choosing Record Again from the panel menu). If available, the command dialog will appear, allowing you to enter new values. Choose OK to apply the new settings or Cancel to leave the original settings.
K. Modal Controls
The modal control is used to enable/disable a command's dialog; hence, it's only available for commands that have an associated dialog. If enabled, a small dialog icon () appears next to the command, and the associated dialog is displayed for that command during action playback. The default is to not display a dialog (indicated by an empty box), and instead, to use the values that were recorded for the command when the action was created.
Note: Enabling (or disabling) the modal control for a set toggles all dialogs for all actions within the set. Similarly, enabling (or disabling) the dialog checkbox for an action toggles all dialogs for all applicable commands within that action.
A red modal control icon () indicates that one or more (but not all) dialogs are enabled within an action (or set).
A grey "ghosted" modal control icon () can mean one of two things:
- the dialog has been enabled, but the command, action, or set has been excluded; or
- the command was inserted without values, via the Insert Menu Item command (in which case, you'll be prompted for values during action playback).
L. Include Checkboxes
The include checkbox () is used to turn action steps — or even entire actions or sets — on or off. By default, all commands are checked, indicating that they are to be included when an action is played. An empty checkbox indicates that the command has been disabled (excluded), meaning that it will be skipped during playback.
Note: Enabling (or disabling) the include checkbox for a set toggles all steps for all actions within the set. Similarly, enabling (or disabling) the include checkbox for an action toggles all steps within that action.
A red checkmark icon () indicates that one or more (but not all) steps within an action (or set) have been disabled.
M. Actions Panel Menu
In addition to the many controls discussed above, the Actions panel menu also contains several commands that are very useful for creating and editing actions. To access the panel menu, click on the button, near the top right corner of the Actions panel.
By default the Actions panel appears in List View Mode. Button Mode turns each action into a button displaying the name, color and keyboard shortcut assigned to it in the Action Options dialog. Simply click a button to play its corresponding action.
To turn Button Mode off (and return to List View Mode), simply choose Button Mode again from the panel menu.
Despite how easy Button Mode is to use, its usefulness is limited because you can't create, edit or modify actions while in this mode.
Insert Menu Item
The Insert Menu Item command allows you to insert the selected menu item into the current action. Inserted items appear below the active action step. This command is available regardless of whether or not you are in record mode.
Two key uses for this command are:
- to insert commands that might otherwise be unavailable (or inaccessible) while in record mode (such as showing or hiding panels); or
- to insert a command without values (and display a prompt during action playback).
A stop is a dialog that pauses the action to display a user-defined message of up to 254 characters. The dialog has a Stop button (hence the name), and may also contain an optional Continue button.
Typical uses for a stop include:
- to display instructions or copyright/version information; or
- to stop playback, allowing the user to perform manual tasks such as painting, or inserting text, prior to resuming playback.
Insert Path is only available when a path (or shape) is selected. This command inserts the selected path into the current action as a series of anchor and handle coordinates.
Use the Set Options/Action Options command to rename an action/set, or to change its function key or Button Mode color. You can also double-click on an action/set to access the Options dialog.
The Playback Options dialog allows you to set the playback speed for actions.
- Accelerated plays actions as fast as possible (desirable for most circumstances);
- Step by Step allows the screen to refresh between commands (useful for debugging); and
- Pause For pauses between commands for the defined number of seconds (between 1 and 60).
The Pause For Audio Annotation option allows you to pause action playback for documents that contain audio annotations.
Clear All Actions
As the name implies, Clear All Actions removes all actions (and sets) from the Actions panel.
Use the Reset Actions command to remove all actions from the Actions panel and replaces them with the default sets. A warning dialog appears, allowing you to accept the replacement, cancel it, or append the default sets to the Actions panel.
Load Actions allows you to load an existing action set. You can also load actions by choosing them (by name) from the bottom of the panel menu, by double-clicking on them in Explorer/Finder, or by dragging and dropping them onto the Photoshop application window.
Note: In order for an action to appear in the panel menu, it must be saved in the
Adobe Photoshop CS#\Presets\Actions\ folder (or subfolder).
Replace Actions replaces all actions (sets) in the Actions panel with those that you select.
Although the contents of the Actions panel are remembered from one session to the next, they're not actually saved until you physically save them using the Save Actions command. In fact, you can't use either of the above commands (Load Actions and Replace Actions) for a set until it's first been saved.
Also, note that you can't save individual actions, only sets. If you want to save a single action, it must be placed into its own set. The best place to save your actions is in the
Adobe Photoshop CS#\Presets\Actions\ folder (or subfolder).
Creating a Simple Action
Okay, enough theory. Time for something practical...
How many times have you double-clicked on a layer to rename it? Wouldn't it be cool to have a keyboard shortcut to do this? Well, why not make your own? Once you get used to using it, you'll wonder how you ever managed without it!
Before you begin recording an action, it's always useful to think through the steps involved. For this example, you could record an action that renames a layer using the Layer Properties dialog; however, it would always name layers using the same name – not very useful. We could turn on the modal control (), but the default name would still always be the name that was recorded with the action. Instead, we'll use the Insert Menu Item command, which inserts the command without assigning any values to it.
Make sure the Actions panel is visible by pressing F9 (Window » Show Actions).
Add a new set by pressing the Create new set button (). Name the set "Shortcuts" (or whatever you like).
Create a new action by pressing the Create new action button ().
When the New Action dialog appears, enter "Layer Properties" for the Name. Assign F2 as the Function Key, since that's typical shortcut for rename (on Windows, at least). Leave "Shortcuts" as the designated Set, and then select a Button Mode color if you wish.
Begin recording by pressing the Record button.
Next, choose Insert Menu Item from the panel menu (). When the Insert Menu Item dialog appears, choose Layer » Layer Properties from the main application menus, then press OK. Notice that an action step called "Select Layer Properties menu item" has been added to the action.
Stop recording by pressing the Stop button ().
That's it! Now let's try it out. Create a new document (Ctrl/Cmd+N, File » New) and add several new layers by pressing Ctrl/Cmd+Alt/Opt+Shift+N. Select a layer and press F2. When the Layer Properties dialog appears, name the layer and try it again on another layer.
Remember: Don't forget to save your actions by choosing the Save Actions command in the Actions panel menu! Read the Save Actions description above for more details.
Creating a More Complex Action
That was fun, but now let's try something a little more complicated.
For this example, we'll create an action that mirrors the active layer across both the vertical and horizontal axes — and we'll do this on a separate layer to ensure that the original layer remains unaltered. Finally, we'll center the results on the canvas. Once you've finished, you'll be able to use the action to create symmetrical shapes, repeating patterns, and refrigerator art.
Assuming the Actions panel is already visible, create a new set (). Name the set "Mirror Corners". Add a new action to the set (). Name the action "Mirror Corners 1.0", and assign a function key and Button Mode color if you wish. Finally, begin recording by pressing the Record button.
Because we're going to duplicate the current layer (to preserve the original artwork), we'll hide the layer so that it doesn't obstruct the view of the final results. Click the visibility icon () associated with the current layer. Notice that a command called "Hide current layer" has been added to the action.
Next, duplicate the current layer by pressing Ctrl/Cmd+J (Layer » New » Layer via Copy). Turn on the new, duplicated layer by clicking on its visibility icon. Both commands should appear in the action.
In this step we'll use the Edit » Free Transform command to flip a horizontal duplicate of the current layer.
Press Ctrl/Cmd+Alt/Opt+T. In the Options panel, set the Reference point location to the right side (); then right-click in the document window and choose Flip Horizontal from the context menu. Press Enter to accept the transformation.
Merge the two halves/layers by pressing Ctrl/Cmd+E (Layer » Merge Down).
Now flip the current layer vertically using the same technique. Press Ctrl/Cmd+Alt/Opt+T to initiate Free Transform. In the Options panel, set the Reference point location to the bottom (); then right-click in the document window and choose Flip Vertical. Press Enter to accept the transformation.
Again, merge the two halves together by pressing Ctrl/Cmd+E.
To center the pattern, first select the entire canvas by pressing Ctrl/Cmd+A (Select » All); then, with the Move tool selected, press the Align vertical centers button ( on the Options panel), followed by Align horizontal centers ().
Drop the selection by pressing Ctrl/Cmd+D (Select » Deselect).
Note: The alignment commands are also available via the menus: Layer » Align To Selection » Vertical Centers, and Layer » Align To Selection » Horizontal Centers.
Stop recording by pressing the Stop button ().
As a final touch, let's add a Stop message to let other users know what this action does. Choose Insert Stop from the Actions panel menu (). Enter a brief description about what the action does and then enable the Allow Continue option.
Since we want the message to be displayed at the beginning of the action, drag the newly added stop to the top of the action, above the Hide current layer command.
Note: If you want the message to be present in the action, but not displayed each time the action is played, simply uncheck the Include checkbox () for the Stop.
Now try your new action on different patterns and image sizes to make sure it works properly. Finally, don't forget to save the action using the Save Actions command.
Tips for Editing Actions
Here are some tips for editing your actions:
- To begin playback from a specific step of an action, simply choose the desired step and press the Play button ().
- Drag and drop steps to reorder them. This also works for actions and sets.
- Alt/Opt-drag a step to duplicate it. This also works for actions and sets.
- Double-click an action step to rerecord its associated values. Alternatively, you may choose Record Again from the Actions panel menu.
- Ctrl/Cmd-click the Play button () to play only the selected step. This is useful for debugging an action.
- Select non-contiguous action steps using the Ctrl/Cmd key. Use the Shift key to range select contiguous action steps. You may then delete, duplicate or even play the selected steps!
- Alt/Opt-click the Delete button () to delete the selected item without confirmation. This is equivalent to dragging the desired item onto the Delete button.
- Even though operations performed in the Actions panel can't be undone using the Edit » Undo command or History panel, you can undo/redo the last operation by pressing Ctrl/Cmd+Z.
- Hold both the Ctrl/Cmd and Alt/Opt keys when choosing Save Actions (from the panel menu) to save all actions as a text file. This is very useful for reviewing or printing the contents of an action; however, the text file can't be reloaded into Photoshop.
- Alt/Opt-click on an action's (not a step's) disclosure icon () to expand or collapse all steps within the action.
- Alt/Opt-click on a set's disclosure icon () to expand or collapse all actions and steps within the set.
To include a path within an action, first create the path (before recording the action); then, begin recording, select the path and choose Insert Path from the panel menu.
Note: Set the ruler units to percentage before using this command to ensure that the path is sized and positioned relative to the canvas, regardless of the canvas' dimensions; otherwise, the path may be too large, or appear completely outside the canvas boundaries.
- Use the Create new snapshot button (), at the bottom of the History panel, to create a document snapshot before running an action. That way, if you do not like the results, you can revert the document to its original state without having to undo every operation performed by the action.
Tips and Guidelines for Creating Actions
Keep things generic
Try to build your actions using commands that don't require specific layer names (unless the layers are created by the action itself).
For example, instead of choosing the previous or next layer by name, use the backward layer and forward layer keyboard shortcuts: Alt/Opt+[ and Alt/Opt+], respectively.
To select the top- or bottom-most layers, press Alt/Opt+. or Alt/Opt+,, respectively.
- Use Percent as your units of measurement for transformations that are meant to be relative to the canvas size, rather than absolute.
- Perform all operations within a single canvas (if at all possible). Photoshop doesn't refer to documents by name, but as "next" or "previous" documents; and this this can cause problems if the number or order of documents changes.
Reduce, reuse and recycle
Optimize your actions wherever possible. The fewer steps, the faster the action will play and the easier it will be to debug when/if something goes wrong.
For example, let's say that you have an action with four steps that duplicates a layer, names it, and then change its blending mode and opacity. All of these operations could, instead, have been accomplished in one step using the options available in the Layer » New » Layer via Copy dialog.
- If several steps need to be repeated, record them as a separate action; then have the first action refer to the second action (like an "action subroutine").
- Examine other people's actions to learn new (or better) ways to accomplish things.
Consideration for other users
- Include instructions (by using stops) that inform others about what the action does and what's expected/assumed. If your action requires additional plugins, provide the name and source of the plugins. You might also want to include your name and email address in case users have problems, or suggestions for improvement.
- Include a version number to distinguish different (updated) versions of the action.
- Test your actions in several different situations to ensure trouble-free operation.
- Preserve original layers whenever possible, or duplicate the document as the first step of the action.
Managing your actions
- Organize your actions by creating subfolders within the Actions folder (
Adobe Photoshop CS#/Presets/Actions/). Photoshop will still find these actions and even make them available from the Actions panel menu.
- Add a tilde (~) to the beginning of action's filename (or even entire subfolders) to disable them. Photoshop will ignore any filenames beginning with a tilde.
- Use the File » Automate » Batch command to play an action on a series/folder of images.
- Use the File » Automate » Create Droplet command to save an action as a droplet. A droplet is a small executable file that will automatically launch Photoshop and apply the embedded action to any images that you drop onto it.
For a great source of free actions, visit Adobe Exchange . Registration is free, and allows you to upload your actions to share with other users.
And if you want to learn even more about actions — a lot more — check out Danny Raphael's Photoshop Actions Tutorial , a mammoth document that covers every aspect of actions in exhaustive detail.
To download the files below, you may need to right-click on the provided links (Ctrl-click on the Mac), and choose "Save Target As".
|Shortcuts||0.2KB||The completed action from the simple example (above)|
|Mirror Corners||2KB||The completed action from the complex example (above)|
|Test Pattern||49KB||A sample pattern to be used with the complex example (above)|