From the course: GIMP Essential Training

Create layer masks - GIMP Tutorial

From the course: GIMP Essential Training

Start my 1-month free trial

Create layer masks

- [Instructor] In this movie we'll see how to create and edit a layer mask in GIMP, and let's say the goal here was to try a different background behind the surfer using the content in the beach layer beneath. You can apply a layer mask by selecting a layer in the layers dialogue and going to the layer menu and choosing mask, add layer mask, or by right clicking on a layer thumbnail, or choosing the same command in the menu of the layers dialogue, and when you use any of these methods, you get a dialogue box. Here you can choose some of the options for your mask. A layer mask in GIMP is actually an extra channel where the value of each mask pixel determines the visibility of the corresponding pixel in your image. Black pixels on the mask make the image transparent, white pixels on the mask leave the image completely visible, and gray values in between give you a partially transparent image pixel. So, for example, a mask filled with 50% gray will make a layer 50% visible, and in the dialogue I can initially make the mask white which leaves a layer with full opacity, black which completely hides the layer, I can use existing alpha channels, I can make a mask based on a selection, so whatever's selected will be visible and what's deselected will be hidden, I could also use a grayscale copy of the layer in which case lighter pixels would be left more visible than darker pixels, or I can pick a channel that was already saved in the image like the surfer silo channel that's saved inside this file. Also note that I have the option to invert any of these choices to reverse the effects of the mask. I'm going to start out with white for full opacity and click add. Now, since the mask is just a grayscale channel which happens to be filled with white right now, I can use any of the tools for selecting and editing images. I can paste content into the mask, I can run filters on the mask, and so on, and when you want to edit a layer mask you first have to be sure that you have the mask selected and not the layer itself. You can select either the mask or the layer by clicking on their thumbnails. So I'll be sure I click on the mask, and then to start simple, I'm going to take the paintbrush tool, I'll choose the hardness 100 brush, I'll set the size to something big like 200 pixels, and make sure I have 100% opacity and that the foreground color is black, and then paint somewhere on the mask, and where I painted with black I can now see through this layer to what's beneath it, and that can continue on in a way that looks like I'm erasing pixels, but the key difference is that I'm only hiding pixels that I can show again by changing the color that I'm painting with. I'll click the small curved arrow by the foreground background colors to reverse them. So now I'm painting with white on the mask, and painting with white reveals some of those areas that I hid previously. If I want to create an effect where this layer is partially transparent, I can use an intermediate gray color, and so to change the color I'm painting with I'll click the foreground color and change the lightness value to 50, and now when I paint on the mask I make areas of this layer 50% opaque, and you might notice as I've been painting on the mask, the thumbnail in the layers dialogue updates to give me an accurate representation of the mask. Clicking and holding on it shows it at a bigger size. If you want to see a full-sized version of the mask in the document window instead of your image, go to the layer menu and choose mask, show layer mask, and on some systems you can use a keyboard shortcut to show or hide the mask by holding Alt, or Option on the Mac, and clicking the mask thumbnail. On other systems, the keyboard shortcut would be Control + Alt click on the mask, and notice when you're viewing the mask it's highlighted in green here, and when you want to go back to viewing the image, use that same keyboard shortcut you used to show the mask. You can also fill a layer mask with a gradient to fade one layer into another. So with the mask selected, I can take the gradient tool, I'll click to reset the default black and white foreground colors, and then drag in the image. I can reposition the ends of the gradient to adjust this mask, and when I'm happy, I'll just press Return or Enter to accept the new gradient mask, and finally, to use a layer mask to hide the background of the top layer, I'll first delete the existing mask by choosing layer, mask, delete layer mask, and then I'll add a new one, layer, mask, add layer mask, and I'll base it on a channel, the surfer silo channel, and click add, and there's our new background. In this movie we got our first look at layer masks which are simply grayscale channels associated with a layer where black conceals and white reveals.

Contents