The trick to being really productive and efficient with computer technology is being lazy. Yes, it's a paradox, but it's truethe 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, Photoshop's automation features 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.)
In the last chapter, we discussed the basics of building actionsparticularly actions that help in the processing of raw files. But Photoshop also 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 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 (see "Editing Actions," later in this chapter). 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.
Keep in Mind
Besides the limits of what you can and cannot record in the Actions palette, there are a few more things to keep in mind.
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).
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.
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 chapter).
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:
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:
Then, to run the action, select the action's tile in the Actions palette and click the Run button (or, better yet, just Command-double-click on the action). If the action is relatively simple, it may perform perfectly the first time. But in most of the actions we make, we find that something goes wrong somewhere along the line, usually due to our performing a step that Photoshop can't record into an action (see "Troubleshooting Actions," later in this section).
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 filewe recommend always making actions that use Save As, rather than saving over the original.
Tip: Making Buttons
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.
Photoshop lets you create sets of actions, a godsend to anyone who works with dozens of actions. Sets are pretty self-explanatory.
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 re-recorded. 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: Duplicating 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 12-61).
Figure 12-61. 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).
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....)
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 section).
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.
Earlier we said that actions cannot perform any task that requires brain activity. However, Adobe's engineers have built some automation tools that do have some "smarts" and placed them in two places: in the Automate submenu (under the File menu) and in the Bridge's Tools menu. These menus are also home to the Batch feature, which lets you run an action on an entire folder of images. Let's take a quick look at some of these options.
(Note that we discuss one automation featurePhotomergein "Compositing," earlier in this chapter, and we cover a second automation featureWeb Photo Galleryin Chapter 14, Multimedia and the Web. We also explore the Automate menu, and especially the oft-infuriating Batch command, in Chapter 11, Building a Digital Workflow.)
Tip: Making Droplets
We're not sure why the Make Droplet feature is hiding in the Automate submenu instead of the Actions palette, but that's where you can find this really awesome feature. You can use Make Droplet to save any Photoshop action to disk as a file. Then, when you want to process an image (or a folder full of images) with that action, you can simply drag the image (or folder) on top of the droplet file.
Bonus tip: If you work on both Macs and PCs, you can copy droplets from one platform to the other. On the PC you simply have to make sure the droplet has an .exe extension. When you bring a PC droplet to the Mac, you have to initialize it once by dragging it on top of Photoshop.
Picture Package is a boon to any photographer tired of duplicating, rotating, and scaling photos to fit pictures on one sheet of film. You can use Picture Package to lay out different versions of the same picture (like school photos, where you want so-many wallet-sized, and so on). Or you can use it to lay out different images together onto one page. The interface is simple enough to understand quickly (see Figure 12-62), though there are a few things to watch out for:
Figure 12-62. Picture Package
Tip: Customized Package Pages
Photoshop offers about 20 different Picture Package layouts, but in case you just gotta' be you, you're welcome to create your own customized layouts, too. Photoshop sports a nifty layout editor (select an example template from the Layout popup menu and then click the Edit Layout button in the lower-right corner of the Picture Package).
The Edit Layout dialog box (see Figure 12-63) works like a basic drawing program: First choose a page size that corresponds to your printed paper size in the Layout area. Then, click on a box (a "zone") to move it or change its size. You can remove a zone by clicking the Delete Zone button, or add one by clicking Add Zone. Unless you're really going wacky and wild, do yourself and everyone around you a favor and turn on the Snap To checkbox so that as you drag or resize a zone it snaps to a grid line; the grid is based on the value in the Size field.
Figure 12-63. Customizing Picture Package
When you're done, give your layout a name and click Save. Photoshop knows just where to save these files (in the Photoshop>Presets>Layouts folder), so you just need to name your file (probably something similar to your layout name) and click Save. The layout name is what appears in the Layout popup menu; the filename is just the on-disk filename.
Contact Sheet II
Contact Sheet builds pages of thumbnails from a folder full of images (see Figure 12-64). In ancient versions of Photoshop, Contact Sheet wouldn't actually label any of the images, making the contact sheet somewhat unusable. That has changed; on the other hand, Photoshop doesn't know what to make of long filenames, and usually truncates them. With any luck, Contact Sheet III will give you even more controls (though who knows when that will show up).
Figure 12-64. Contact Sheet II
Crop and Straighten Photos
The Automate features are designed to save you from mind-numbing grunt work, and the Crop and Straighten Photos feature fits that bill exactly. If you throw four photos on a flatbed scanner, you can either scan four times (adjusting the scanning area each time) or scan once, duplicate the resulting file three times, and crop each one a unique image. Now you've got another choice: Scan once and choose Crop and Straighten Photos from the Automate submenu. This feature does the work for you by analyzing the image, duplicating it, cropping it, and rotating each one so that it sits straight. If you decide you only want a couple of the images on the page, draw selection marquees around the ones you want, and Photoshop will focus on them.
Obviously, the more clearer the boundaries are between the images the better the feature works. Crop and Straighten Photos usually works quite well, but we've found we sometimes still need to do a little cropping cleanup on some images (especially old photos that don't have clearly defined boundaries or in contact sheets with black borders). On rare occasions, Photoshop breaks an image into two or more pieces (if the colors in the image have areas that are too similar to the color around the images). In that case, make a selection around the image and then hold down Option/Alt while selecting the feature from the Automate submenu.
Most folks don't tend to think of Photoshop as a tool for making templates that will be filled in with content at a later date, but the Variables feature should change that. Variables lets you turn a static Photoshop document into a dynamic one that can change based on information stored in a database or spreadsheet. For example, you might have 300 photographs of products for your catalog and you want to place each product's price on top of its image. In addition, perhaps you want to place a starburst over the products that are new in this year's catalog. You can use variables to perform this task with no special scripting knowledge.
There are three kinds of variables in Photoshop: visibility (whether a layer is visible or not), text (the text that appears on a text layer), and picture (the image that appears on a layer). To set up the example above, you could make a four-layer Photoshop file: the blank background layer; another layer filled with white; a text layer with any random text on it in the size, style, and position you want the price to appear; and a layer with a "New!" starburst image on it. After you create this template:
If actions and variables got you all excited about automating Photoshop, you're going to love scripting. Scripting is a way for one application (or your system) to talk to another application behind the scenes. For instance, in Mac OS X 10.3 or later, you can attach a script to a folder, so that as soon as you drop an image into the folder, your system launches Photoshop, performs several operations on it, saves the file, and then closes it again; it's all handled automatically.
Scripting is one of the coolest features in Photoshop, and it works on both the Macintosh and Windows platforms, but almost no one knows about it because Adobe doesn't advertise it well.
Scripting vs. actions
There are four basic differences between actions (which are also called macros) and scripts. First, actions are entirely dependent on the user interfacethe menus, dialog boxes, keyboard shortcuts, and so on. Scripts, however, let you sneak in the back door of the program and control it from behind the scenes, almost like a puppeteer pulling the strings of a marionette. Second, scripts have flow control. Flow control is a programming term that means you can set up decision trees and loops, like "keep doing this until such-and-such happens." Third, scripts often contain variables, so you can save the value of something (like the color of a pixel) to use it later.
Last, scripting lets you control more than one program at time. For example, if you use QuarkXPress (which is also scriptable on the Macintosh) or InDesign (which is scriptable on both Macintosh and Windows), you could write a script that would automatically "see" how you've rotated, sized, and cropped images within your picture boxes. It could then open the images in Photoshop, perform those manipulations on the original images, resave them, and re-import them into the page-layout program. Powerful stuff!
Tip: Hiring a Scripter
Even though scripting is extremely powerful, it's just a fact of life that most people don't want to learn the ins and outs of scripting. Fortunately, there are a number of scripters for hire. You can find a good scripters on Adobe's scripting forum: www.adobe.com/support/forums/. If you're looking for a scripter for the Macintosh, there are also consultants listed at www.apple.com/applescript/resources/.
First steps in scripting
We don't pretend that we can actually teach you how to script Photoshop in this book. Although we believe that almost anyone can learn how to write scripts (especially using AppleScript, which is much easier than other forms of scripting), scripting is still a form of computer programming and as such, it takes time and patience to learn. So where can you learn it?
Even if you never find yourself writing scripts, you're missing out if you don't know how to run themthe example scripts that Adobe provides are extremely helpful. AppleScript and Visual Basic scripts must be run from outside of Photoshop, from a program like Script Editor (which ships free with all Macs).
Tip: Running Scripts on Events
In the previous chapter, we described an action that would add several adjustment layers to a bunch of files in a batch process. Another way of going about this is to apply this action as an event script, which runs each time you perform a task such as opening a document. (Yes, event scripts work with both scripts and actions.) To create an event script, choose Scripts Events Manager from the Scripts submenu (under the File menu) and turn on the Enable Events to Run Scripts/Actions checkbox (see Figure 12-67).
Figure 12-67. Run a script on an event
Next, choose an event from the Photoshop Event popup menusuch as Open Document, Save Document, or Start Application. (You can also add your own events if you understand the Photoshop scripting model well enough.) Now choose a Script or Action at the bottom of the dialog box.
When you click Done, Photoshop starts "listening" for your event to take place. As soon as you perform the event, the action or script is triggered. For example, you might have a script that opens a set of files each time you launch Photoshop and an action that creates a thumbnail and saves it as a JPEG each time you open a document. But remember to come back and turn off the checkbox at the top of this dialog box if someone else is going to use your copy of Photoshop. Otherwise, they'll be mighty confused as to why Photoshop is acting so oddly.
Tip: Hard-Core Scripting
Tip: Scripting the Unscriptable