Photoshop Layer Tutorial: Locking Layers
Free Tutorials And Training For Beginning Adobe Photoshop Users
In our look at Photoshop's Layers palette, we saw that there are several options for locking layers, all of which are found at the top of the Layers palette directly below the Layer Blend Modes option, as I've highlighted below:
Each of these options has a different effect on what we can and can't do with the layer. By default, none of these options is selected, which means we have no limitations on what we can do with the layer. The one exception to this is the Background layer, which is locked by default as we saw in the section which covers the Background layer in more detail.
We'll take a closer look at what effect each of these locking options has on a layer in a moment, but first, we need a new document so we have something to test these options out on. Let's create our document. The fastest way to create a new document is to simply press Ctrl-N (Win) or Command-N (Mac) to instantly bring up the New Document dialog box. You don't have to name it for what we're doing here, and it doesn't matter what the width and height are. I made mine 400 pixels for the width and 300 pixels for the height, but you can make it any size you want. The only thing you need to make sure of is that you select "Transparent" for the Background Contents. Here's what my "New Document" dialog box looks like:
Click the OK button when you're done, and Photoshop will present you with your new document filled with a checkerboard pattern to represent transparency, as shown below:
And here's what your Layers palette should look like:
Notice that we have one single layer to start with but that Photoshop gave it the generic name "Layer 0" rather than "Background", since we specifically asked for a transparent background and Photoshop's special "Background" layer doesn't support transparency (if that doesn't make sense to you, check out the section which covers the special Background layer in more detail here).
The next thing we need to do is add something to this layer so that part of it contains image pixels (in other words, we need to place some sort of graphic or image on the layer so it contains something other than transparency). We don't need anything fancy, so let's quickly add a simple rectangular shape to the layer. First, we'll need a color for our shape, and the fastest way to select a color is by selecting a "ready to go" color from the Swatches palette:
The Swatches palette is grouped by default with the Color and Styles palettes, and (again by default), it's hiding behind the Color palette in the group. Just click on the name tab that says "Swatches" and the palette will move in front of the Color palette. If you don't see these palettes at all on your screen, go up to the Windows menu at the top of the screen and select "Swatches" from the list of palettes. Once you have the Swatches palette open, go ahead and click on any color square to select that color. I chose the red color in the top left corner, but it makes no difference which color you choose. Pick your favorite.
Next, we need our shape. We could do this the long way, which would be to select the Rectangular Marquee Tool from the Tools palette, drag out a selection, then go up to the Edit menu, select Fill from the list of options, choose "Foreground Color" for the Contents option, and then click OK, but that's just nonsense when there's a much faster way of doing this.
Go to the Tools palette, and rather than choosing the Rectangular Marquee Tool, choose the Rectangle Tool instead. You'll find it in the right-hand column of icons directly between the "T" icon (the Type Tool) and the eyedropper icon (the Eyedropper Tool), as shown below:
You can also press the letter "U" on the keyboard to quickly select it. The difference between the Rectangular Marquee Tool and the Rectangle Tool is that the Rectangular Marquee Tool is used to drag out a rectangular-shaped selection, which you then have to do something with (like fill it with a color, for example) once you've dragged it out. The Rectangle Tool drags out an actual, well, rectangle, which will automatically be filled with whichever color we currently have selected as our foreground color (which is why we picked our color first).
Once you have the Rectangle Tool selected, there's one more quick thing we have to do, and that's go up to the Options Bar at the top of the screen and click on the "Fill Pixels" option, as shown below:
This is the option that's going to fill the pixels inside of our rectangle with our foreground color automatically for us (there's really more to it than this, but it involves a discussion about the difference between pixels and vector shapes which we don't need to get into for what we're doing here).
Now that we've selected a color, we have the Rectangle Tool selected, and we've clicked on the "Fill Pixels" options in the Options Bar, all we need to do now is click anywhere inside the document window and drag out a rectangle. Just make sure your rectangle takes up only a portion of the document, not the full width and height. We need to keep some of the layer transparent. When you're done, you should have something similar to what I have below:
And we're done! We have our document with our single transparent layer, we have a rectangle somewhere inside of it so that we have actual content on the layer, and the rest of the layer surrounding the rectangle remains transparent. Now we can go ahead and look at what effect each of the four locking options has our layer.
Lock Transparent Pixels
The first option we have for locking a layer, starting from the left, is "Lock transparent pixels". The icon is a square with a checkerboard pattern inside of it, and the reason is because Photoshop uses a checkerboard pattern to signify transparency in a layer. By clicking on this option to select it, we lock down any transparent pixels (transparent areas) in the layer so that we can affect areas with actual image content on them (image pixels).
To show you an example of what I mean, click on the Brush Tool icon in the Tools palette to select the Brush tool:
You can also press the letter "B" on the keyboard to quickly select the Brush tool.
Next, with the Brush tool selected, right-click (Win) or Command-click (Mac) anywhere inside the document window, which will bring up a dialog box with various options for the Brush tool:
Choose 20 pixels for the Master Diameter (for no particular reason other than it's what I chose), and 100% for the Hardness of the brush, as shown above. There's no "OK" button to press when you're done, so just click anywhere outside of the document window to close the brush options.
The next thing we need to do is select a different color to paint with, so go back to the Swatches palette and choose a different color (make sure it's different from the color you filled your rectangle with otherwise you won't be able to see what's happening). I'm going to choose a blue color, which you can see in the screenshot below, but again, feel free to choose any color you wish as long as it's different from the color of your rectangle:
Once you have your new color selected, it's time to paint! First, make sure the "Lock transparent pixels" option is selected in the Layers palette, since showing the effects of this option is the whole point of what we're doing. With your Brush tool selected, your new color chosen, and "Lock transparent pixels" selected, click anywhere inside your document and start painting. Make sure you paint strokes cover the transparent areas as well, not just the rectangle.
Notice what's happening? With "Lock transparent pixels" selected, none of the transparent areas are being affected by your brush! The only area you're able to paint on is the rectangle, as you can see in my document window below:
That's the effect that "Lock transparent pixels" has on the layer. It prevents you from doing anything to the transparent areas of the layer. You can only affect areas with image pixels (areas which are not transparent).
Let's take a look now at the next option, "Lock Image Pixels".
Lock Image Pixels
The second option from the left, with the brush icon, is "Lock Image Pixels". Now, you may be thinking that "Lock image pixels" is the exact opposite of "Lock transparent pixels", and that by selecting it, you'll only be able to paint over the transparent areas while the rectangle itself won't be affected. Sounds reasonable, so go ahead and try it. First, click on the "Lock image pixels" icon to select it, which will automatically deselect the "Lock transparent pixels" option. Then, with the Brush tool still selected, click anywhere inside the document window and start painting.
Were you able to paint on the transparent areas? Nope, Photoshop put a stop to that idea right away and gave you an error message instead:
With "Lock image pixels" selected, you still can't paint on the transparent areas of the layer, but now you also can't paint on the image pixels either. In fact, the only thing you can do with that rectangle at this point is move it around inside the document with the Move tool (press the letter "V" on the keyboard to quickly select the Move tool from the Tools palette, then click and drag anywhere inside the document window and you'll see the rectangle moving along with you).
Rather than being the opposite of "Lock transparent pixels", "Lock image pixels" simply adds to the limits of what you can do with the layer.
Now let's look at the third option, "Lock position".
Lock Position
The third option for locking a layer, moving from left to right, is "Lock position", which is the icon with the directional arrows. So far, we've seen that "Lock transparent pixels" prevented us from painting over any transparent areas of the layer, and we've seen that "Lock image pixels" added to that by preventing us from painting over the rectangle as well. Is it safe to assume that "Lock position" is going to add even more limitations to what we can do with the layer? Let's find out! First, click on the "Lock image pixels" icon again to deselect it, and then click on the "Lock position" icon to select it (clicking "Lock position" will not automatically deselect the "Lock image pixels" option).
Now that "Lock position" is selected (and both "Lock transparent pixels" and "Lock image pixels" are deselected), let's try painting on the layer again with our Brush tool, just to see what happens. First, for fun, let's pick a different color to use once again. I'm going to choose green this time from the Swatches palette. Again, pick whichever color you prefer. Then, with the Brush tool still selected (you may have to select it again from the Tools palette if you had the Move tool selected a moment ago) and your new color chosen, try to paint anywhere inside the document window.
What happened? Photoshop has gone back to allowing us to paint anywhere we want inside the document!
As you can see in the screenshot above, I was able to paint with my green brush anywhere I wanted, whether it was over a transparent area or the rectangle (the image pixels). "Lock position" had no effect at all on where I was able to paint.
So what does "Lock position" do then? Well, select the Move tool from the Tools palette. It's the first tool in the top right of the Tools palette, beside the Rectangular Marquee Tool:
You can also press the letter "V" on the keyboard to quickly select it.
Now, click and drag your mouse around inside the document window to move the rectangle (and any paint strokes that fall outside of the rectangle) around on the screen. You'll see your mouse moving around inside the document, but nothing else will be moving, and when you release your mouse, you'll get this:
That's because while "Lock position" has no effect on where we paint in the document, it prevents us from moving anything around on the layer.
So, "Lock transparent pixels" prevents us from painting on the transparent areas, "Lock image pixels" prevents us from painting on both the transparent areas and the image pixels (the areas that are not transparent), and "Lock position" prevents us from moving anything on the layer, although it has no effect on where we could paint.
Before we look at the final option, "Lock all", it's important to note that while "Lock position", on its own, had no effect on where we could paint inside the document, you can use it in combination with either "Lock transparent pixels" or "Lock image pixels" to add those limitations to it. If you select "Lock transparent pixels" and "Lock position" together, you'll be prevented from painting on the transparent areas of the layer and you won't be able to move anything on the layer. Selecting "Lock image pixels" in combination with "Lock position" will effectively lock everything at once. You won't be able to paint anywhere or move anything.
Which brings us to our final option, "Lock all".
Lock All
If using a combination of "Lock image pixels" and "Lock position" effectively prevents us from painting anywhere inside the document and from moving anything on the layer, you might think that "Lock all" would be nothing more than a one-click option for doing the same thing, and to some extent, you'd be right. "Lock all" does prevent us from painting anywhere on the layer, and it prevents us from moving anything on the layer as well. But "Lock all" isn't kidding around. It takes things even further.
Here's a screenshot of my Layers palette with the "Lock all" option selected:
Look up at the top of the Layers palette. The Layer Blend mode options are grayed out. The Opacity option is grayed out, and the Fill option is grayed out. None of these options are available to us anymore with "Lock all" selected. Also, look at the bottom of the Layers palette. The Layer Styles option is grayed out, the Layer Mask option is grayed out, and the trash bin (delete layer) is grayed out (the Link option is also grayed out, but that's because I only have one layer in the Layers palette and you need at least two layers to be able to use the Link option). "Lock all" disables all of these options, as well as prevents us from painting on the layer and from moving the layer around.
And that's out look at the Lock options in the Layers palette.