Quantcast


(1 vote, average 5.00 out of 5)
Share

 image

A step by step tutorial on how to create a layer mask in GIMP.  You can use a layer mask to remove, change or make abackground transparent.

The first step to successfully replacing or swapping out an image background in GIMP, especially one with a lot of fine detail, is to create a layer mask.

In this tutorial, we will learn how to create a layer mask for use in masking the background in order to change or alter said background.  This masking technique does require some time to complete, however, the results are quite professional.  If you’ve ever tried to remove or alter an image background, you’ve doubtless had some issues doing a clean selection of the image subject – especially around hair, folds or areas with a lot of fine detail.  A good layer mask will allow you to retain fine detail, such as hair, folds in clothing and particles.

Let’s get to it!

  1. Launch GIMP and open your image.  For this tutorial, wewill be using this photo: bg_1.jpg.
    image 
  2. From the GIMP main menu, select “Colors>Components>Decompose”.
    image 
  3. From the “Decompose” window that pops up, select “RGB” for Color model and “Decompose to layers”.  Click “OK”.
    image 
  4. From the Layers Panel on the right, right-click the “red” layer and select “Delete Layer”.  Do the same for the “blue” layer.
    image 
  5. When you are done, you should be left with only the “green” layer.
    image   
  6. From the Toolbox Panel on the left, select the “Free Select Tool”, otherwise known as the lasso.
    image
  7. To use the Free Select Tool, simply press and hold the left mouse button and trace a contour around the area you wish to select.  In this case, we want to select the subject of the photo.  Be careful not to get too close – we want to avoid accidentally cutting details from our selection.  When you are done, it should look like this:
    image
  8. Now that we have selected our subject, we want to invert our selection in order to allow us to fill the background (area surrounding our subject) with black.  To invert your selection, use “Select>Invert” or Ctlr+I.
    image 
  9. From the Toolbox Panel on the left, select the “Bucket Fill Tool” and in the Bucket Fill properties below, select “Fill Whole Selection”.  Make sure your fill color is black.
    image 
  10. Click once in the background area of your photo to fill it with black.
    image 
  11. Now we need to undo our selection.  To remove it, “Select>None” or Ctrl+Shift+A.
    image 
  12. From the GIMP main menu select, “Colors>Threshold”.
    image 
  13. Using the slider in the “Threshold” window, tweak your threshold in order to obtain a fairly strong white outline.  We will clean this up with our Brush Tool afterwards.  Click “OK”.
    image 
  14. Now we are going to clean up our background before proceeding to filling our subject.  To clean up our background, from the Toolbox Panel on the left, select the “Brush Tool”.  From the properties section below, make sure “Opacity is set to 100% and use the “Scale” slider to scale your brush size up or down whenever needed.  Also make sure that your foreground color is black (same as background fill).
    image 
  15. Increase your zoom to 200% or 400%, using the zoom  drop down on the bottom left.

    image
  16. Scroll over your photo and brush over any small white areas that don’t belong to the subject.  Everything you paint over in black will be masked when we apply it to our original photo.
    image 
  17. When you are done, it should look like this:
    image 
  18. Now, we change our brush color to white and fill over the entire area of our subject with the “Paintbrush Tool”.  Once done, it should look like this:
    image 
  19. This is your completed mask.  We will use this as a layer mask in our next tutorial: GIMP – How to remove or alter an image background.  You should save this file.



Add this page to your favorite Social Bookmarking websites

Comments  

 
0 #1 zeke43 2010-04-14 00:17
Quoting Paul:
Long way around just to remove or replace a background when a quick mask will do.

Agreed Paul! However, this particular technique, while a bit involved, allows for selection of fine particles - hair-fur. Quick Mask may be a touch faster but requires a pretty steady hand and I doubt you could retain as much fine detail without spending an equal amount of time zooming and painting your mask in on a near pixel level.
Appreciate your comment!

Regards,
zeke43
Quote
 

Computers & Software - GIMP Tutorials

More GIMP Tutorials

  • 1
  • 2
  • 3
  • 4
  • 5

Subscribe or Share

Facebook Twitter Digg Delicious Google Bookmarks RSS Feed 

Login/Register

Alternative flash content

You need to upgrade your Flash Player

Get Adobe Flash player



Support us!

Please help support content development for this site. If you liked our tutorials and would like to see more...
Donate:
  Monthly Monthly
Currency
 CAD
Amount

Other Great Sites

Latest Files

Jun.10

The jigsaw puzzle overlay used in our GIMP Advanced Jigsaw Puzzle effect tutorial.

Visitors Counter

mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday:1226
mod_vvisit_counterYesterday:3212
mod_vvisit_counterThis Week:20229
mod_vvisit_counterThis Month:10085
mod_vvisit_counterLast Month:89056

Since January 18th, 2010