Opacity is the the degree of transparency of an image layer. When applied to a layer mask it is the shade of grey through which the layer is viewed - the nature of a notional sheet of glass through which an image layer is viewed. If a black grid is laid out on one layer and a red gradient is drawn across another, changing the opacity of the upper gradient layer will determine the extent to which the grid can be seen through the red gradient.
Opacity is a particularly valuable part of the concept of layers in digital image manipulation. Layers enable numerous versions of the same image can be laid precisely on top of each other like a stack of identical postcards. If one of those layers is then altered in some way, perhaps by lifting the shadow detail in a particular dark area, the improved area needs to be merged into the original image. A single change may be easy to implement by merely changing the original single-layer image and re-saving. However changes are often more complex, and can only be achieved within an unique layer because they may otherwise bring about undesirable alterations in other parts of the image. For instance, removing an excessive blue cast from distant mountains may render the foreground an unacceptable colour. The principal editing requirement is therefore to be able to alter an area of an image and then merge the improved area into the final version without changing other aspects of the image.
Layer masks are the key to achieving selective changes of this type. Each layer is covered by a mask which effectively controls which areas of the particular layer can be seen, and which remain hidden. Layer masks also control the extent to which changed layers are visible and hence influence the final image. Each layer in the stack of originally identical images may have its own layer mask - effectively a sheet of blackened glass laid over the image through which nothing can be seen. However this notional sheet of glass can be selectively cleaned and rendered transparent in areas where improvements have been made to the image. The changes are then visible when merged into the final image. Layer masks are effectively transparent when painted with white, and opaque when painted with black.
Layer masks can also be painted with any shade of grey. A mid-tone grey represents an opacity of 50% and allows the associated layer to be perceived through the mask in a partial or vague manner - rather like looking through a very dirty window. Changing the opacity of the layer mask alters the grey tone with which it is painted, and hence changes the clarity with which the image on the associated layer may be perceived. This is rather like making a window more or less dirty.
This invaluable facility allows a photographer to make various subtle changes to numerous versions of the same image, and to control the extent to which each change is visible in the final image. For example the excessive blue tint in distant mountains may be removed in one layer, perhaps to greater extent in some mountains than in others, and then merged into the final image and combined with other quite different changes without altering satisfactory parts of the original image.