How to select only the bright or dark parts of a photo
Luminosity Masks in Paint by Zaweba select the Lights, Darks or Midtones as soft selections that follow brightness, for gentle targeted edits.

Use Select > Luminosity Masks. In Paint by Zaweba it gives you the Lights, the Darks or the Midtones of the picture as soft selections that follow brightness, so the brightest pixels are fully selected, the middle ones partly, and the darkest not at all. Each comes in levels 1 to 4, from broad to narrow, and edits made through them blend in without a visible edge.
This sort of selection is the photographer's answer to a common problem. You want to pull back bright clouds without dulling the land, or lift deep shadows without greying the highlights, and a hard selection would leave a line where the change stops.
How a luminosity mask works
A normal selection is either in or out. A luminosity mask is a gradient of selection based on how bright each pixel is. Lights at level 1 take in almost everything bright, while higher levels narrow it to only the very brightest parts. Darks work the same way from the other end, and Midtones picks the middle while leaving both ends alone.
Because the selection follows the picture's own tones, it wraps itself round clouds, leaves and faces without any drawing. That is why the results look natural.
Step by step
Open the photo and choose Select > Luminosity Masks, then pick Lights, Darks or Midtones and a level. The selection is made from the visible picture, so it takes every layer into account.
For more control use the Luminosity Mask command. It adds a fifth strength level, lets you use the active layer as the source instead of the whole picture, and shows a live preview. It also offers the same outputs as Focus Area: a selection, a layer mask, a new layer or a new layer with a mask. A layer mask is usually the most useful, because you can see it and paint on it.
With the selection active, add an adjustment layer and mask it to the selection, so a Curves layer pulls down only the bright parts, or lifts only the dark ones. Turn the layer's opacity down if the effect is too strong.
Useful jobs
Darkening a bright sky is the classic one: Lights at a higher level, then a gentle Curves or Levels change. Opening up shadows in a backlit portrait is another: Darks, then lift them a little. Midtones are handy for adding contrast or colour to the body of a picture without clipping the extremes.
You can also use them while painting. Dodge and burn on a blank layer through a Lights or Darks mask and your strokes only land where the tones fit, which makes it hard to overdo the edges.
Getting a good result
Start with a broad level and narrow it only if the change spreads too far. Check the mask itself now and then, because seeing the grey values makes it obvious what will change. The commands work at 8, 16 and 32 bits per channel, and working in 16 bits gives smoother results when you make strong tonal moves, since there are more steps between dark and light.
Combining with other selections
Luminosity masks combine well with others. Intersect a Lights mask with a sky selection to darken only the bright clouds, or with a rough lasso to keep a change to one side of the picture. Paint by Zaweba keeps all of this as editable masks, so you can always come back and soften a decision later.