Sub topic 10
Hiding and locking layers
This chapter assumes you can open a document, find the Layers panel, select a layer, and tell pixel layers from other layer types. It covers two protections: hiding a layer so it does not appear in the image, and locking a layer so it cannot be changed by accident.
Visibility versus locking
Visibility and locking solve different problems.
- Visibility controls whether a layer takes part in compositing. A hidden layer is skipped when Photoshop builds the image from bottom to top.
- Locking controls whether you can edit a layer. A locked layer still composites normally. It just refuses certain edits.
A layer can be visible and locked, hidden and unlocked, or any other mix. The two settings do not affect each other.
Hiding layers with the eye icon
Each row in the Layers panel has an eye icon at the far left. Click it to hide the layer. Click the empty square where the eye was to show it again.
Useful behaviors:
- Alt-click (Windows) or Option-click (Mac) the eye to show only that layer and hide all others. Repeat the same click to restore the previous visibility state.
- Click and drag down the eye column to toggle several layers in one stroke.
- Hiding a group hides everything inside it, but the visibility of each child layer is remembered. Showing the group again brings back exactly the children that were visible before.
- Hidden layers are still in the file. They add to file size and can be edited, but they do not appear in exports such as PNG or JPEG.
Why hide a layer
Hiding is a non-destructive way to compare versions and keep alternatives.
- Compare before and after. Toggle an adjustment layer to see its effect.
- Keep alternatives. Stack three headline treatments and show one at a time.
- Hide reference material. Keep a sketch or a guide photo in the file without it showing in the export.
- Isolate a problem. Hide layers one by one until a strange color or edge disappears. The last layer you hid is the cause.
The four lock types
Locks appear in a row labeled Lock at the top of the Layers panel. Select a layer, then click an icon. Click it again to remove the lock.
| Lock | Icon | What it prevents | What still works |
|---|---|---|---|
| Lock transparent pixels | Checkerboard | Painting on transparent areas | Painting on existing pixels, moving, transforming |
| Lock image pixels | Brush | Any painting or pixel editing | Moving, transforming |
| Lock position | Crossed arrows | Moving the layer | Painting, changing opacity |
| Lock all | Padlock | All of the above | Visibility, opacity, blend mode, reordering in some cases |
Lock transparent pixels
This lock lets you recolor a shape without spilling outside it. Suppose a layer holds a black logo on a transparent background. With transparent pixels locked, any brush stroke only changes pixels that already have content. You can paint a whole logo red in a few strokes and never touch the empty area.
Lock image pixels
This blocks brush, eraser, filters, and fills. It is useful for a finished retouching layer that you still want to nudge into place.
Lock position
This stops the Move tool and arrow keys from shifting the layer. Use it for a background texture or a border that must stay aligned to the canvas.
Lock all
This is the strongest lock. Photoshop shows a solid padlock on the layer row. Use it for finished work you want to leave alone.
Artboard lock
When you work with artboards, a fifth option can appear that prevents automatic nesting of layers into and out of artboards. You will not see it in a normal layer document.
How locks appear in the panel
A layer with some locks, but not all, shows a hollow padlock. A layer with Lock all shows a solid padlock. A group can be locked as well. Locking a group applies the lock to every layer inside it.
The Background layer
The Background layer is locked by default. Its padlock cannot be removed with a click. To unlock it, double-click the layer and confirm the New Layer dialog, or click the padlock icon. After that it behaves like a normal layer. The previous chapter on the Background layer covers what it can and cannot do.
Common errors and how to fix them
- "Could not complete your request because the layer is locked." The layer has a lock that blocks the action. Check the Lock row and remove the specific lock.
- A brush does nothing. The layer may have Lock image pixels or Lock all. Another cause is a hidden layer. Photoshop will not paint on a hidden layer and shows a warning cursor.
- A move does nothing. Lock position or Lock all is on. A linked layer does not cause this, but a locked layer in a link set can stop the group moving.
- A layer is not in the export. It is hidden, or its parent group is hidden.
- Painting spills outside a shape. Transparent pixels are not locked.
- Lock icons are greyed out. Several layers of different types are selected, or the layer is a type that does not support that lock, such as some smart object cases.
Scripting visibility and locks
You can set the same properties in ExtendScript. Visibility is the visible property. Lock settings are on the pixelsLocked, positionLocked, transparentPixelsLocked, and allLocked properties of the layer.
// ExtendScript (.jsx): hide a layer, then protect it
var doc = app.activeDocument;
var layer = doc.activeLayer;
layer.visible = false;
layer.allLocked = true;Note that allLocked is available on art layers and layer sets. Test it on a copy before running it across a large document.
A practical workflow
- Finish a layer.
- Name it clearly.
- Lock it with the narrowest lock that does the job. Use Lock position for alignment-critical items and Lock all for finished work.
- Hide reference and alternate layers, and keep them in a group named for what they are.
- Before export, check the eye column for anything unexpectedly hidden or visible.
Exercise
You have a layer holding a black star on a transparent background. You want to paint the star gold without any paint landing on the transparent area, and you want to keep it from moving afterwards. Which locks do you use, and in what order?
Show answer
First turn on Lock transparent pixels, then paint over the star with gold. Only existing pixels change. After painting, turn on Lock position so the star cannot move. If you want to block further painting too, add Lock image pixels or use Lock all instead.
Exercise
A colleague exports a PNG from your file and a title is missing. The title layer is not deleted and is not locked. What is the most likely cause, and how do you check?
Show answer
The title layer, or a group containing it, is hidden. Look at the eye column in the Layers panel. An empty square next to the layer or its parent group means it is hidden. Click the square to show it, then export again.