Layer masks 2015-04-12

Layer masks allow localised pixels of a layer to be exlcuded from the overall image, without deleting those pixels from the layer. The mask is best understood as a mask on top of the layer that prevents the pixels below from being seen. Therefore white pixels in the mask allow the pixels below to be seen, black prevents them and grey alters the opacity of the pixel. Masks are typically used to enable non-destructive editing, which will be a future blog post.

The mask operation can be considered as a alpha channel adjustment to the layer, as below. (See the stet image representation if this isn't clear).

for(var byte in image)
  image[byte + 3] = mask[byte + 3];

To add a mask to a raster layer of the image, click . The mask is then the right thumbnail of the pair. Clicking again will apply the mask to the layer, and delete the invisible pixels - this is a destructive action.

Back to blog