Sketch supports two types of mask, Outline and Alpha, and you can create them from all types of Layers (including images).
There are a few different ways to create masks in the Mac app, but they all follow the same rule: we’ll use the shape that’s lowest in the Layer List as the mask.
How to create an Outline Mask
An Outline Mask only shows parts of a layer or multiple layers that fall within its shape. There are a few ways to create them.
Select a shape on your canvas and choose Layer > Mask > Use As Mask. Alternatively, you can control-click on the shape and select Mask.
When you create a mask, we’ll add icons to any layers or groups above it in the Layer List to show that they’re being affected by the mask. If you drag another layer or group above the mask, it will also be affected by it.
If you want to place objects above your mask layer but don’t want them to be included in the mask, select it and choose Layer > Mask > Ignore Underlying Mask.
You can also group your masked layers and the mask itself so that anything outside of that group isn’t affected.
If you select multiple layers at the same time, you can mask them all at once by choosing Layer > Mask > Mask With Selected Shape. This will use the shape at the bottom of the Layer List within your selection as the mask and automatically group them all.
When you have multiple layers selected, Control-clicking on your selection and choosing Mask has the same effect as Mask with Selected Shape.
Selecting a layer within a mask group and choosing Layer > Mask > Ignore Underlying Mask will keep it within the group, but stop it from being affected by the mask.
How to create an Alpha Mask
Alpha masks in the Mac app hide anything that falls outside of their shape and also control the opacity of any layer they’re masking.
To create an Alpha mask, create an outline mask like normal, then select it and choose Layer > Mask > Mask Mode > Alpha Mask.
Head to your mask layer’s Fills in the Inspector and be sure that it has a fill which has an Opacity / Alpha value or a gradient fill which includes an Alpha. This is what Sketch will apply to any masked layers. You can also add a blur for a smoother look.
Comparing Outline and Alpha masks
The best way to understand Masks is to experiment with the Mask types and the Style settings of the Mask Layer.
You can use any Layer, including images, as a mask. In the case of PNG images with transparency, when they are used as an Alpha Mask the transparency will be reflected.
You can use Fills and Gradients on Alpha masks and blur the edges of the Mask and even combine multiple fills to create the effects you want.