Real World Adobe Photoshop CS2
by Bruce Fraser and David Blatner
![]()
Excerpted from Real World Adobe Photoshop CS2 by Bruce Fraser and David Blatner © 2005. Used with the permission of Pearson Education, Inc. and Peachpit. To purchase this book, please visit www.adobepress.com.
by Bruce Fraser and David Blatner
The trick to being really productive and efficient with computer technology is being lazy. Yes, it’s a paradox, but it’s true—the lazier you are, the more likely you are to find the really efficient ways of doing things so you can get out of work faster and go to the beach. If you have an overzealous work ethic, you probably don’t mind repeating the same mind-numbing tasks 400 times, but you won’t be exploiting the power of the computer in front of you.
For example, Bruce works with a lot of digital cameras, and each digital camera’s images need a particular kind of tweaking. Rotate the image 90 degrees, run this filter, use that Curves setting, resize the image to such-and-such…. Instead of performing each task one at a time, he can run through them all with a keystroke. Even better, the automation features in Adobe® Photoshop® CS2 let you batch process all the images in a folder, so you don’t even have to open them in Photoshop.
As Photoshop gets smarter with each new version, we can offload more busywork onto it while we take longer trips to the fridge for artichoke dip. (We’re just hoping that Photoshop doesn’t get too smart and starts making us do the work while it gets the dip.)
Photoshop offers four automation features: actions, Automate, Variables, and scripting. Actions are “macros” that live in the Actions palette and let you repeat a series of steps. Photoshop ships with a number of premade actions, and you can easily build your own (we’ll show you how). Automate refers to the built-in tools in the Automate submenu (under the File menu). Variables is a way to create a template image that changes depending on data imported from a spreadsheet or a database. Scripting is a way to automate Photoshop from behind the scenes using AppleScript, JavaScript, or Visual Basic. We’ll look at each of these techniques in turn.
Photoshop comes with a number of premade actions that are not only useful, but educational, too, because you can look at them to see how they produce their magic. (You can load additional sets of actions by selecting Load Actions from the Actions palette’s popout menu, or by choosing the presets that appear at the bottom of the popout menu.)
The key is that you can only make an action for something you can do methodically, with no feedback from the program, and with little or no brain activity. For example, you can’t record an action that says, “if the pixels in the upper-left corner of the image are sort of reddish, then do such-and-such.” That would require Photoshop to be able to see and respond. No can do.
However, you can easily create an action that runs a particular set of Curves, adds a text layer, adds a layer effect, sharpens the background layer, and so on, because all these things are methodical.
Tip: Exporting Actions as Text. Trying to decode how other people made actions can be a hassle because the Actions palette is hard to read. Fortunately, you can export all the actions currently visible in the palette as a text file that you can open in a word processor: just hold down Command and Option while selecting Save Action from the Actions palette’s popout menu.
Before you get too heady with your newfound actions power, you should know that Photoshop doesn’t let you record everything you might want. While Photoshop can record blend modes, opacity, shapes, brush selections, and even pixel selections, you still cannot record paint strokes (like those made with the Brush, Airbrush, and Clone tools), zooms, switching windows, and scrolls. And there are many features that aren’t necessarily recordable, but you can force them into an action. Last but not least, the whole Actions mechanism has a logic unto itself. If an operation isn’t recordable by keyboard shortcut, it may be recordable by choosing the menu command instead, or vice versa.
Besides the limits of what you can and cannot record in the Actions palette, there are a few more things to keep in mind.
Difficulty. While recording and playing simple actions (those with only two or three steps) may be easy, trying to build complicated actions can be damaging to your head (and the wall you’re banging it against).
Modularity. Rather than trying to make one big action that does everything you want, break it down into smaller steps that you can debug individually, then chain together to reuse in more complex actions.
Think it through. You should always think the action through completely before you start recording it. You might even write down each step on paper, and then record it after you’re pretty sure everything will work out the way you think.
Generic actions. Try to make your actions as generic as possible. That means they should be able to run on any image at any time. Or, barring that, provide the user with a message at the beginning of the action noting what kind of image is required (as well as other requirements, such as “needs text on a layer” or “must have something selected”). This is a good idea even if you’re the only one using your actions, because (believe us) after you’ve made a bunch of actions, you’ll forget which action requires what (see “Tip: Talk to Your Users,” later in this tutorial). There are a number of things to think about when making your actions generic. The following is a good place to start, but isn’t necessarily a complete list:
Clean up. It’s a good idea to make your actions clean up after themselves. In other words, if your action creates three extra channels along the way to building some other cool effect, the action should also probably delete them before ending. If the action hasn’t cleaned up after itself and you run it a second time, those channels (or layers, or whatever) are still hanging around and will probably trip up the action.
Get more info. This section offers a quick overview of actions, but if you have Web access, check out one or more of the actions-oriented sites on the Internet like http://share.studio.adobe.com. You can also find more links from a site such as www.photoshopnews.com.
Making an action is pretty straightforward:

Figure 1: The Actions palette
Tip: Save your work first. If you run an action and then decide that you don’t like what it did, you’re in trouble because you cannot undo a full action, only the last step of an action. If the action used only a few steps, you might be able to use the History palette to return to a pre-action state, but this isn’t always possible either, particularly if you ran the action as a batch process on multiple files. To guarantee an “undo” option, we’re in the habit of saving a snapshot of our document in the History palette before running any action. That way, if something goes wrong or we don’t like the effect, we can revert back to this snapshot. Another option is to simply save your document first, and then use the Revert command (in the File menu) to undo the action. Of course, neither of these techniques works with actions that save and close the file—we recommend always making actions that use Save As, rather than saving over the original.
Tip:You can change the Actions palette into a palette full of buttons by choosing Button Mode in the palette’s popout menu. When it’s in Button mode, you only have to click once on a button to run it. Switch out of Button mode to create new actions or edit existing ones.
Sets. Photoshop lets you create sets of actions, a godsend to anyone who works with dozens of actions. Sets are pretty self-explanatory.
Editing actions. Once you’ve built an action, you can edit it (in fact, you’ll almost certainly want to edit it unless it worked perfectly the first time). If you want to record additional steps somewhere in the middle of the action (or at the end of the action), select a step in the action and click the Record button. When you’re done recording actions, click the Stop button. All the new actions fall after the step you first selected.
If you want to add a step that cannot be recorded for some reason (perhaps it’s an item in the View menu), you can select Insert Menu Item from the Action palette’s popout menu. This lets you choose any one feature from the menus, and then inserts it into the action (after whatever step is currently selected).
To change the parameters of a step, double-click on it in the Actions palette. For example, if a step applies a curve to the image (using the Curves dialog box), but you want to change the curve, double-click on the step and choose a different curve. Note that when you do this, you may actually change the current image; just press Command-Z to undo the change (to the image, not to the action).
Annoyingly, some steps cannot be rerecorded. For instance, a step that sets the foreground color to red should be able to change so that it sets it to blue… but it can’t. Instead, you have to record a new step, then delete the original.
If you want to change the action’s name, its tile or button color, or its keyboard shortcut, just double-click on the action’s name.
Tip: Duplicate actions. Option-dragging a step duplicates it. For instance, if you want to use the same Numeric Transform step in two actions, you can Option-drag that step from one action into the proper place in the second action.
Tip: Stop where you are. Normally, Photoshop won’t display any of the usual dialog boxes when you run an action. For instance, if you include a Numeric Transform step in an action, Photoshop just performs the transform without displaying the dialog box. But you can force Photoshop to display the dialog box, stop, and wait for the user to input different settings before continuing. To do so, click once in the second column of the Actions palette, next to the step. A black icon indicating a dialog box appears next to the step, and a red icon appears next to the action’s name.
Don’t click on a red dialog box icon! If you do, it turns black and Photoshop adds a black “stop here” icon next to every step in the action that can have one. There’s no Undo here, so the only way to reset the little black icons to their original state is to turn them on or off one at a time. (You can, however, turn them all off by clicking the black icon next to the action’s name.)
Note that if you insert a step using the Insert Menu Item command, Photoshop always opens the appropriate dialog box and doesn’t even offer you the chance to turn this icon on or off (because steps inserted in this way are meant to simulate the user actually selecting the item).
Tip: Talk to your users. You can insert a command at any point in your action that stops the action and displays a dialog box with a message in it. This message might be a warning like, “Make sure you have saved your image first,” or instructions such as, “You should have a selection made on a layer above the Background.” To add a message, select Insert Stop from the Actions palette’s popout menu. Photoshop asks you what message you want to appear and whether the message dialog box should allow people to continue with the action (see Figure 2).

Figure 2: Adding a message
If the message is a warning, you should turn on the Allow Continue option, but if the message consists of instructions, you may want to leave this checkbox off. When Allow Continue is turned off, Photoshop stops the action entirely. After the user clicks the OK button in the message dialog box, Photoshop automatically selects the next step in the Actions palette, so the user can continue running the action by clicking the Run button again (this works even if the Actions palette is in Button mode).
Saving actions. After you’ve created the world’s most amazing action, you may want to share it with someone else. You can get actions out of your Actions palette and on to your hard drive by selecting Save Actions from the Actions palette’s popout menu. Unfortunately, you cannot save a single action; the Save Actions feature only saves sets of actions. Fortunately, the workaround isn’t too painful.
Of course, you can load sets of actions just as easily with the Load Actions and Replace Actions features in the palette’s popout menu. Watch out for Replace Actions and its cousin Clear Actions; these replace or clear all the actions in the palette, not just the selected one.
Tip: Curves and Adjustments. We love the fact that Photoshop can record the exact settings of the Curves, Levels, and Hue/Saturation dialog boxes. Nonetheless, you should note that if you record loading a Curves file from disk (or a Levels or Hue/Saturation file, or any other adjustment), Photoshop records the name of the file rather than the curve itself. The workaround: record loading the setting in the Curves dialog box (or whatever), then change the settings just a tiny bit before clicking OK. As long as there is a difference, Photoshop records the settings in the dialog box rather than the file’s name. Remember that you can always go back and change the settings back to the way you want them.
Sometime, somewhere, something will go wrong when you’re building actions. That’s where troubleshooting comes in. When troubleshooting (or debugging, as it’s often called), the most important thing to keep in mind is that there must be a logical solution to the problem. (This isn’t always true, but it’s good to keep a positive attitude….)
Dummy files. The first thing you should do after building an action is not test it on some mission-critical image. Rather, try it on a dummy image. Even better, try it on several dummy images, each in a different mode (RGB, CMYK, Grayscale, Indexed Color), some with layers, some without, some with selections made, others without, and so on. If it doesn’t operate correctly on any one of these, you can decide whether to work at making it work or to add a message at the beginning of the action that says “don’t try it on such-and-such-type of images” (see “Tip: Talk to Your Users,” earlier in this tutorial).
Step-by-step. You can force Photoshop to pause between each step and redraw the screen by selecting Step-By-Step in the Playback Options dialog box (you can choose this from the popout menu in the Actions dialog box).
This is often useful, but the best troubleshooting technique in the Actions palette (in fact, probably the only troubleshooting technique) is to select the first item in the action and click the Run button while holding down the Command key. This plays only the first step. Now go check out all the relevant palettes. Is the Channels palette the way you expect it? What about the Layers palette? What are the foreground and background colors?
When you’re convinced that all is well, press Command-Run again to check the second step in the action. And so on, and so on….
If at any time you find the palettes or colors set up improperly, now is the time to replace the last step or double-click on it to change its settings. If something is really messed up, then don’t forget the Revert feature.
Tip: Use History. The History palette, when suitably configured, lets you step backwards through all the steps in an action, making it a great deal easier to figure out just where things went awry. So much so, in fact, that we wouldn’t dream of trying to debug complex actions without it. The key is simply to make sure that you set Photoshop’s Preferences to record a large enough number of History states to cover all the steps in the action.