Pen Tool

This tool works very differently from the other masking tools. It creates paths using straight and curved lines which are drawn directly on to the image. It can produce very precise masks which have the added advantage of being dynamic ie they can be edited further at any point. It is a difficult tool to master but is well worth getting to grips with. It is an ideal tool for working with well-defined subjects within your image. Buildings, parts of buildings, vehicles and manmade objects are all examples of subjects which will work well with the pen tool. Inversely, it is of little use for complex, irregular shapes such as trees in leaf and hair or objects with very indistinct edges such as clouds.

The Pen tool can be activated by pressing P or by clicking the Pen icon on the toolbar. There are a number of other tools and functions available from this button. I would recommend you ignore all of these except the Pen tool itself as everything you will need to do can be done with the Pen tool alone.   

You may not see the Content-Aware Tracing Tool as this is still in development. This may turn out to be a useful tool in some situations but I haven’t found it very useful in its current form.

How does the  Pen Tool work?

Masks are created with the pen tool by ‘drawing’ around a subject in your image using a combination of straight and curved lines. All of the pen tool operations are described below.

The Paths Panel

This isn’t the most useful panel as some of the options aren’t very appropriate for photography. However, options D and E can be helpful in creating and refining selections. You can also hide a visible path by clicking in an empty area of the panel window.

A: Current paths

B: Fill the path with the foreground colour. Not useful for photographic reasons.

C: Add a stroke to the outline of the path. Again, not useful for photographic reasons.

D: Load Path as a Selection. The selection can be adjusted and used like any other selection. It’s worth noting that the path itself remains so it can be re-used.

E: Create a path from a selection. This will replace the currently selected path so you may wish to create a new path before using this option.

F: Create a layer mask.

G: Create a new path.

H: Delete Path(s) – Drag any path or paths and drop them on the bin icon.  

Terminology

Path: This is the set of lines which are created with the pen tool. In the example opposite, the path is shown with the thicker blue lines. Where photography is concerned, paths are usually closed to form a complete shape. 

Anchor Points: These are shown in the centre of the red circles. These are the points which are added every time you click the Pen tool. The active anchor point is denoted by a filled square.

Direction Lines: These lines show the direction of curves. They can be ‘pulled’ in any direction to influence the angle of the curve.

Curve Handles: These are shown in the centre of the green circles. They can be dragged to edit the curve.

Path Operations

The illustrations in this section are simple graphics, designed to show clearly what can be done. Please note that, in order to make them more ‘readable’, the lines created by the pen tool are thicker than they would usually be.

Start a new Path

Click anywhere in your image to begin a new path or add a separate section to an existing path.

Straight Lines

Straight lines are very easy to do. Click once to start your path. Subsequent clicks will cause straight lines to be added. Holding down the SHIFT key as you click will constrain lines to 45o angles. This guarantees your lines will be straight.

In the example opposite, a square was selected with the Pen tool. The blue line is the path and the blue squares inside the red circles are the anchor points.

The bottom left-hand corner was clicked to create an initial anchor point – the start point. Then the other three corners were clicked. Lastly, the start point was clicked again to complete the path.

The SHIFT key was pressed throughout so a perfectly straight line was added each time.

Curved Lines

Curves are created by clicking and dragging. An anchor point is set when you click and the direction and length of the direction line is determined by dragging away from the anchor point.

In the illustration opposite, each anchor point was created with a single click. Without releasing the mouse button, a line was then dragged in the direction shown by the red arrows. The SHIFT key was also pressed to constrain the direction lines so that they were straight. The result is a very precise path which outlines the green circle. 

Edit Curves

Convert a straight line to a curve

Hold down the ALT key, click on an anchor point and drag. It’s also possible to convert a curved line to a straight line by holding the ALT key and clicking on (don’t drag!) a curve anchor point.

Edit the direction and angle of any curve

Hold down CTRL and click/drag a curve handle.

A path was added using straight lines.

Two anchor points were converted to curves and edited to include the ‘dome’.

Move an Anchor Point

To move an anchor point, hold down CTRL and double click on the anchor. (You will only need to double-click the first time.) Keep holding CTRL and drag the point to wherever you want.

Add an anchor point 

Click anywhere on the path line to add a new anchor point.

Delete an anchor point

Click on an existing anchor point to delete it.

Closing a Path

Although paths can be left open, this is not very useful for processing photographs. Paths are closed by clicking on the point you first created. A small circle will be added to the cursor when you are within range of the start point.

Using the Pen Tool

  • Select the Pen tool by pressing P or clicking the Pen icon on the toolbar.
  • Decide what you want to select and choose a start point. This will also be your endpoint.
  • Click once and release if you want to begin with a straight line….. OR…. Click and drag if you want to start with a curve.
  • Go round the subject, adding straight or curved lines. Add anchor points only  where necessary.
  • You can adjust curves as you go or complete the selection and adjust when this is done.
  • Move, add or delete anchor points as required.
  • Finish your selection by clicking again on the start point.
  • Right-click anywhere inside the path you have created.
  • Select ‘Make Selection’ to create a normal selection with marching ants….. OR…. Select ‘Create Vector Mask’. (See next module.)

It’s always easier to create accurate masks if you zoom in closely to the area you are working with. Holding the SPACEBAR will activate the Hand tool which makes it easy to move around your zoomed image.

Example

Step 1

This is the original file. The image had been straightened up a little and cropped. The black and white points had been set. No other adjustments were made at this point.

Step 2

A black and white adjustment layer was added.

Step 3

A path was created around the brightly lit side of the church. This was used to create an ordinary selection.

Step 4

A Curves adjustment layer was added using the mask created in the previous step. The midtones of the side of the building were brightened even more.

Step 5

An inverse of this mask was created using the same selection. This included everything except the bright side of the church. The bright areas of the gravestones at the bottom left were then removed from the selection using the Color Range Tool.

A second Curves adjustment layer was added using this new selection. This was darkened by a considerable amount to produce the final image.