It's 11 PM on the night before your big presentation. You've been working on this image for thirteen hours, and you're beginning to experience a bad case of "pixel vision." After making a selection, you run a filter, look carefully, and decide that you don't like the effect. But before you can reach Undo, you accidentally click on the document window, deselecting the area.
That's not so bad, is it? Not until you realize that undoing will only undo the deselection, not the filter... and that you haven't saved for half an hour. The mistake remains, and there's no way to get rid of it without losing the last 30 minutes of brain-draining work. Or is there? In this section of the chapter, we take a look at the various ways you can save yourself when something goes terribly wrong.
The first defense against any offensive mistake is, of course, Undo. You can find this on the Edit menu, but we suggest keeping one hand conveniently on the Command and Z keys, ready and waiting for the blunder that is sure to come sooner or later. Note that Photoshop is smart enough not to consider some things "undoable." Taking a snapshot, for instance, doesn't count; so you can take a snapshot and then undo whatever you did just before the snapshot. Similarly, you can open the Histogram, hide edges, change foreground or background colors, zoom, scroll, or even duplicate the file, and Photoshop still lets you go back and undo the previous action.
Revert to Saved
You'd think this command is pretty easy to interpret. If you've really messed up something in your image, the best option is often simply to revert the entire file to the last saved version by selecting Revert from the File menu. In Photoshop CS, Revert occasionally caused us trouble because it ignored anything we'd done in the Missing Profile or Profile Mismatch dialog boxesit reverted to the file that opened in Photoshop, not the one saved to disk. Photoshop CS2 punts on the whole issue by making Revert unavailable if you make changes in either of these dialog boxes.
The History Palette
There is a school of thought that dictates, "Don't give people what they want, give them what they need." The Photoshop engineering team appears to advocate thisthey spend hours listening to and thinking about what people ask for, then they come back with a feature that goes far beyond what anyone had even thought to request. For example, people long asked Adobe for multiple Undos (the ability to sequentially undo steps that you've taken while editing a Photoshop image). The result is the History palette, which goes far beyond a simple Undo mechanism into a whole new paradigm of working in Photoshop.
The History palette, at its most basic, remembers what you've done to your file and lets you either retrace your steps or revert back to any earlier version of the image. Every time you do something to your imagepaint a brush stroke, run a filter, make a selection, and so onPhotoshop saves this change as a state in the History palette (see Figure 2-35). At any time, you can revert the entire image to any previous state, orusing the History Brush tool or the Fill command, which we'll discuss in a momentselectively paint back in time.
Figure 2-35. The History palette
The only issue with using History is that it can consume a lot of scratch space. Sorry, did we say "a lot"? We meant "vast, awe-inspiring, mind-boggling quantities" of scratch space, particularly since Photoshop's old 100-state limit was increased to 1000 in Photoshop 7. It's unlikely that heavy History use will hurt performance significantly, though if Photoshop has to hunt for something in 50 GB of scratch disk space you may experience a momentary lapse in responsivenessthe bigger danger is that you run out of scratch disk space and find yourself unable to do anything, possibly including saving the file. If you plan on using 1000 history states, make sure you have plenty of scratch disk space!
Tip: Turning Off History
If you're doing straightlaced production work all day (the kind of work for which a single Undo is perfectly adequate), you may want to avoid the History feature's heavy scratch disk overhead by changing the History States value to 1 in the Preferences dialog box (press Command-K). Similarly, you can turn off Automatically Create First Snapshot in the History Options dialog box (which you can find on the History palette's flyout menu). You might also want to turn off these functions if you're going to batch-process a number of images using actions or the Automate "wizards" (because in these cases, History isn't necessary), but unless your scratch space is very limited, as on a laptop with a single internal drive, the default 20 history states are probably pretty safe.
The History palette has two sections: snapshots and states. Let's take a look at each of these and how you can use them.
The History palette lets you save any number of snapshotsrepresenting a moment in time for your imageso that at any time you can go back to a specific state. There are two main differences between snapshots and states.
Tip: What's in the Snapshot
When you click the New Snapshot button on the History palette (or select New Snapshot from the palette's flyout menu), Photoshop saves the whole document (individual layers and all). Depending on how many layers you have and how large your document is, this might require a lot of scratch space. If you Option-click the button, Photoshop offers two other less-storage-intensive snapshot choices: a version of the image with merged layers, or just of the currently selected layer. (If you find yourself Option-clicking the button a lot in order to get these options, then turn on the Show New Snapshot Dialog By Default checkbox in History Options. That way, you don't have to press the Option key anymore.)
Stepping through states
As we mentioned earlier, Photoshop saves every brush stroke, every selection, every any thing you do to your image as a state on the History palette (though the state only remains on the palette until you reach the maximum number of states or you close the document). There are three ways to move among states of your image.
In general, when you move to an earlier state, Photoshop grays out every subsequent state on the History palette, indicating that if you do anything now these grayed-out states will be erased. This is like going back to a fork in the road and choosing the opposite path from what you took before. Photoshop offers another option: if you turn on the Allow Non-Linear History checkbox in the History Options dialog box, Photoshop doesn't gray out or remove subsequent states when you move back in time (though it still deletes old states when you hit the maximum number of states limit).
Non-Linear History is like returning to the fork in the road, taking the opposite path, but then having the option to return to any state from the first path. For example, you could run a Gaussian Blur on your image using three different amountsreturning the image to the pre-blurred state in the History palette each timeand then switch among these three states to decide which one you wanted to use.
The primary problem with Non-Linear History is that it may confuse you more than help you, especially when you're dealing with a number of different "forks in the road."
The History Brush
Returning to a previous state returns the entire image to that state. But Photoshop's History feature lets you selectively return portions of your image to a previous state, too, with the History Brush and the Fill command. Before painting with the History Brush, first select the source state in the History palette (click in the column to the left of the state from which you want to paint). For instance, let's say you sharpen a picture of a face with Unsharp Masking (see Chapter 9, Sharpness, Detail, and Noise Reduction) and find that the lips have become oversharp. You can select the History Brush, set the source state to the presharpened state, and brush around the lips (though you'd probably want to reduce the opacity of the History Brush to 20 or 30 percent by pressing 2 or 3 first).
The History Brush tool (press Y) is very similar to the Eraser tool when the Erase to History checkbox is turned on in the Options bar, but the History Brush lets you paint with modes, such as Multiply and Screen. We used to prefer the History Brush over Erase to History or Fill from History, because they didn't work on high-bit files, but that limitation has disappeared in Photoshop CS2, so now we use whichever gets the job done most easily.
Tip: Snap Before Action
If you run an action in the Actions palette that has more steps than your History States preference, you won't be able to "undo" the action. That's why before running the action you should either save a snapshot of your full document or set the source state for the History Brush to the current state. The latter works because Photoshop never "rolls off" the source state in the History palette, so you don't have to worry about its getting deleted after reaching the maximum number of states.
Fill with History
One last nifty technique that can rescue you from a catastrophic "oops" is the Fill command on the Edit menu (press Shift-F5). This lets you fill any selection (or the entire image, if nothing is selected) with the pixels from the current source state on the History palette. We usually use this in preference to the History Brush or Eraser tools when the area to be reverted is easily selectable. Sometimes when we paint with those tools, we overlook some pixels (it's hard to use a brush to paint every pixel in an area at 100 percent). This is never a problem when you use the Fill command.
You've always been able to press Option-Delete to fill a selection or layer with the foreground color. In version 4, Photoshop added the ability to automatically preserve transparency on the layer when you add the Shift key (slightly faster than having to turn on the Preserve Transparency checkbox in the Layers palette). Similarly, you can fill with the background color by pressing Command-Delete (add the Shift key to preserve transparency). To fill the layer or selection with the current history source state, press Command-Option-Delete. And, of course, you can add the Shift key to this to fill with Preserve Transparency turned on.
Tip: Persistent States
Remember that both snapshots and states are cleared out when you close a document. If you want to save a particular state or snapshot, drag its tile over the Create New Document button on the History palette. Now that state is its own document that you can save to disk. If you want to copy pixels from that document into another image, simply use the Clone Stamp tool (you can set the source point to one document and then paint with it in the other file).
Tip: Revert When Revert Doesn't Work
Deke McClelland taught us a trick at a recent Photoshop conference that has already saved David's buttocks several times. Because David has a tendency to type fast and loose, he'll often press Command-S (Save) when he really meant to press Command-A (Select All) or Command-D (Deselect). Of course, this saves over his file on disk, often ruining his original scan. The History palette to the rescue! Remember that the default preference for the History palette is to create a snapshot of the image when you first open it. If you save over your original image, you can drag the snapshot's tile over the Create New Document button in the History palette to re-create the original data in its own file.
Tip: Copying States
Although Photoshop lets you copy states from one document to another simply by dragging them from the History palette onto the other document's window, we can't think of many good reasons to do this. The copied state completely replaces the image that you've dragged it over.
Tip: When History Stops Working
Note that you cannot use the History Brush or the Fill from History feature when your image's pixel dimensions, bit depth, or color mode has changed. Pixel dimensions usually change when you rotate the whole image, use the Cropping tool, or use the Image Size or Canvas Size dialog boxes.
Tip: Purging States
As we said earlier, the History palette takes up a lot of scratch disk space. If you find yourself running out of room on your hard disk, you might try clearing out the History states by either selecting Clear History from the flyout menu on the History palette or choosing Histories from the Purge submenu (under the Edit menu). The former can be undone in a pinch; the latter cannot. Curiously, neither of these removes your snapshots, so you have to delete those manually if you want to save even more space. Remember that closing your document and reopening it will also remove all snapshots and history states.