Layers are easy to manage, but a little housekeeping will maximize your productivity.
Layers and File Size
When working with layers the news is nearly all good, but there are a few things to keep in mind. As you work on an image keep an eye on its file size at the bottom of the application window. The first number indicates the flattened document file sizei.e., if all the image data were compressed into a single layer. The second number indicates the document size, taking into account additional layers, alpha channels, and paths. Specifically, these numbers refer to the size of the document in memory. Depending on the file format chosen the actual file size on disk may be considerably smaller.
Figure 3.09. Keep an eye on your document file size as you add layers.
Layers add to a file's size, although it's worth noting that only the active pixels of a layer are taken into accountthe surrounding transparent areas don't cost you anything. Still, too many layers can bloat a file as well as clutter things up, so delete any you no longer need by dragging their thumbnails to the Trash icon at the bottom of the Layers palette.
There is no right number of layers. How many you have is determined by the demands of your image and your available computer memory, but most of all by common sense. Keep it simple, but don't think twice about adding layers as needed.
Only some file formats preserve layers: Photoshop, TIFF, Photoshop PDF, and Large Document. If saving to a format that doesn't support layers, you need to flatten the image. Flattening compresses all layers into a single background layer, making any transparent areas white. Flattening reduces file size, but you lose the advantages that layers offer. When switching color modes, for example from RGB to CMYK, be sure to click Don't Flatten or Don't Merge to preserve your layers. Note that color mode conversions will affect adjustment layers, either flattening them into the image, or discarding them altogether. See Chapter 5, "Adjustment Layers."
When the Selection button is checked, your selection is previewed in the Color Range dialog box like a grayscale alpha channel. While I've never found any reason to change this, you can, if you wish, see your selection preview in the image window and choose from the Selection Preview drop down menu to view the selection as Grayscale, against a black or white matte, or as a Quick Mask.
Certain types of image usage necessitate flattening your image. However, if you choose File > Save As you can make a flattened copy and retain your layered original. When creating Web images in JPEG or GIF formats, use the Save for Web option under the File menu to create a flattened copy rather than overwriting your layered original. In the relative scheme of things, disk space is cheap and time is tight, so I always keep layered versions of my images; that way if I need to make edits I can call up the layered original and save a new flattened version from that. It used to be necessary to flatten files before importing them into a page layout program, but this is no longer the case with the most recent versions of InDesign and QuarkXPress.
Layered files are flexible; flattened files are not, so think carefully about flattening.
Merging is like flattening, but on a local levelonly your visible or your select layers are flattened into a single layer. Merging allows you to combine elements that no longer need to be on separate layers, cutting down on file size and clutter. When you merge layers, what's on the top layers replaces the overlapped data on layers below. The intersection of all transparent areas in the merged layers remains transparent. Merging layers permanently changes layers, so don't be too zealous with your spring cleaning.
A more cautious approach is to merge layers and keep the separate layers. This does nothing to reduce file size, but can speed up workflow while an image is in an unfinished state by creating a work-in-progress layer. Merging selected layers is also useful when you need to apply a filter, like Unsharp Mask or Smart Sharpen, to the whole image rather than individual layers.
To merge multiple layers into a new layer and still keep your existing layers, select the layers you want to merge and press Command/Ctrl-Shift-Option/Alt-E. The new layer is added over the topmost selected layer.
Figure 3.10. A merged work-in-progress layer.
As an alternative to merging layers, you can make the layers into a Smart Object layer. That way you can work with the original separate layers, if necessary, by editing the Smart Object. For more information, see "Nondestructive Editing with Smart Objects" later in this chapter.
It only takes a moment and it can save confusion later down the road. Double-click the layer or group name in the Layers palette, and enter a new name. You can also color-code layers to establish relationships that are easy to identify. Use a consistent naming convention for your layers. For example, I name sharpened layers "Sharp 150/1/0;" the first number records the amount of sharpening, the second the radius, and the third the threshold.
Using layer groups shortens the list of names on the palette and means less scrolling up and down trying to find the layer you're after. You can expand and contract the group folder as necessary by clicking the arrow to the right of the group name.
You can nest groups within other groups up to five levels deep. You can also move, rotate, scale, duplicate, lock and unlock, hide and show, link, and copy the contents of layers grouped together.
To group layers, select the layers you want to group and choose New Group from Layers in the Layers palette menu. Once the group is created you can add layers to it by dragging them to the group folder. You can mask multiple layers by applying a layer mask or vector mask to a group rather than an individual layer. See "Viewing and Editing Layer Masks" in Chapter 4, "Layer Masks." To ungroup the layers, select the group and choose Layer > Ungroup Layers.
Figure 3.11. Using layer groups was essential for creating this type poster (example A). Each letter is on its own layer and is in a group folder that also contains any associated retouching layers and adjustment layers (example B). The ordering of the layer groups began as alphabetical, but I found it necessary to change the layer stacking order to have certain letters overlap with others.
Aligning and Distributing Layers
The Align and Distribute buttons are straightforward, but can be confusing nonetheless. I sometimes find it takes a few clicks to get exactly what I want. To align or distribute layers, you use either the menu options (Layer > Align or Layer > Distribute) or the button in the Move tool options bar. If you have a selection active, your layer(s) are aligned relative to that selection. Choose Command/Ctrl-A to select all if you want to align your selected layers to the whole canvas. Note that you also have several nonprinting visual aids available under the View menuGuides, Grid, and Smart Guides (guides that appear automatically)to help you when manually aligning and distributing layers.
Figure 3.12. The Move tool alignment and distribution options.
Figure 3.13. Centering a layer within the canvas by aligning to a selection (examples A and B). Distributing and aligning layers (examples C and D). First, I chose Command/Ctrl-A to select the whole canvas, and then I distributed the horizontal centers and aligned the vertical centers.
You can lock a layer's transparency, its pixels, and its position to protect it from change. When you're finished with a layer you can lock it fully. Or, while you're still working on the layer, you may want to lock only its transparency to prevent "painting outside the lines," but still allow repositioning of that layer. Or vice versa. When a layer is fully locked, a solid lock icon appears to the right of the layer name. When a layer is partially locked, the lock icon is hollow. For Type layers, Lock Transparency and Lock Image Pixels are always on.
To lock all layer properties, click the Lock All icon at the top of the Layers palette (shown in Figure 3.02).
If a layer has a layer mask attached and the transparency of that layer is not locked, you can paint on the transparent areas but you won't see any paint unless you discard or disable the layer mask.
To partially lock a layer, select one or more of these lock options:
Figure 3.14. Locking Transparency. Painting without locking transparency (example A) and with the transparency locked (example B). Note the Lock icon next to the layer name in the Layers palette.
Certain elements of a layered composition may be made up of vectors: for example, type layers, shape layers, or Smart Objects containing vector data. Vectors lend themselves to crisp artwork and have the advantage of being resolution-independent, but while they remain as such you can't use your painting tools or filters on these layers. There may be times (though perhaps not as often as you may think) when you need to rasterize a vector layerthat is, convert it to pixels. When you do so, a warning dialog informs you that you'll no longer be able to edit the layer as vectors. Select the layers you want to rasterize (Layer > Rasterize) and then choose the appropriate option from the submenu.