Gimp: Add text to Layer Mask?


I'd like to have a layer mask in Gimp that includes some text. I currently have a method of achieving this, but it's a little more crude than I'd like.

In this image, the top text is a simple text layer sitting over a plain blue background. The bottom text is the result of the following procedure:

  1. Create a plain background and a separate text layer.

  2. In the layers dialog, right click on the text layer, and select, "Alpha to Selection".

  3. Hide the text layer, select the background layer, right click and select, "Add Layer Mask".

  4. In the resulting dialog, select to initialize the layer mask to "White (full opacity)"

  5. Selecting the 'Bucket Fill Tool' with the colour black, fill the selected area.

  6. In the layers dialog, right click the blue background layer, and select, "Apply Layer Mask".

  7. Create a new black background behind the blue layer.

Difference between original and masked text

The difference is small, but noticeable (especially since I scaled the image up to 500%). It does slightly change the look of a font.

It's perhaps more noticeable as a gif:

enter image description here

My question is, how can I add text to a layer mask without losing any of the fine details of the font?

4/23/2014 10:35:00 PM

Accepted Answer

I cannot see any difference if I use:

  • right click on text layer > alpha to selection
  • select background layer and press DEL

Same, if I use your way but use Ctrl + , to fill the text selection with black in the layer mask.

I just added a white area, so anyone can see it's a animated gif and it's working.

enter image description here

4/23/2014 11:06:00 PM