To mask an image in GIMP, you use Layer Masks, which control the transparency of a layer. Here’s a breakdown of how to do it:
Understanding Layer Masks
A layer mask is essentially a grayscale image that's attached to a layer. The mask determines which parts of the layer are visible or transparent. Black areas on the mask make the layer completely transparent, white areas make it completely opaque, and shades of gray create partial transparency.
Steps to Add a Layer Mask
-
Select the Layer: In the Layers panel, select the layer you want to mask.
-
Add a Layer Mask: Go to Layer → Mask → Add Layer Mask...
-
Choose Mask Options: The "Add Mask Options" dialog will appear, presenting you with several options to initialize your mask. Here are the common ones and their effects:
Option Effect White (full opacity) The entire layer remains fully visible. This is a starting point where you manually paint or use gradients to create transparency. Black (full transparency) The layer is entirely hidden. You would paint on this mask with white to reveal portions of the layer. Layer's Alpha Channel The mask is initialized using the layer's existing alpha channel (transparency). Grayscale copy of layer The mask is created based on the greyscale version of the layer, where darker parts make the layer more transparent. White (full opacity), The entire layer remains fully visible. This is a starting point where you manually paint or use gradients to create transparency. Black (full transparency), The layer is entirely hidden. You would paint on this mask with white to reveal portions of the layer. Layer's Alpha Channel, The mask is initialized using the layer's existing alpha channel (transparency). Grayscale copy of layer, The mask is created based on the greyscale version of the layer, where darker parts make the layer more transparent. Selection The mask is based on current selection - The most common initial choices are White (full opacity) or Black (full transparency), depending on whether you want to start with the layer fully visible or fully hidden.
-
Click Add: After you have selected your desired options, click "Add" to apply the mask.
Editing the Layer Mask
- Select the Mask: In the Layers panel, click on the thumbnail of the mask (it’s next to the layer thumbnail). If the mask is not selected you will be painting on the image not the mask.
- Paint on the Mask: Use the Paint tools (e.g., Paintbrush, Bucket Fill) with grayscale colors.
- Black: Makes the corresponding parts of the layer transparent.
- White: Makes the corresponding parts of the layer opaque.
- Gray: Makes the corresponding parts of the layer partially transparent.
- Use Gradients: You can also use the Gradient tool on the mask to create smooth transitions between visible and transparent areas.
- Other Tools: You can also use other tools to edit the mask, like the Eraser, Smudge, or Blur tools.
- View the mask: You can view the mask in greyscale by toggling the visibility of the eye in the layer panel. Clicking the mask in the layer panel again will return to image view.
Examples and Practical Use Cases
- Creating a Vignette: Use a black-to-white gradient on the mask to create a soft darkening around the edges of your image.
- Compositing Images: Layer mask two images and then use gradients and brushes to blend them seamlessly.
- Removing a background: Use a selection tool and create a mask from selection to remove unwanted elements in an image.
By using these techniques, you have full control over what parts of your image are visible, and you can achieve highly complex and refined effects.
Layer masks are a non-destructive way of editing your image as you are not actually removing the pixels. You can hide and show them as required.