gimpusers.com logo
German version English version

Not logged in

Sign up! | Lost password?

Latest discussion

  1. gimp-docs | yesterday 10:55 PM
    a new user perspective
  2. gimp-developer | yesterday 08:04 PM
    scanner support should be File->Acquire
  3. gegl-developer | yesterday 06:24 PM
    babl docs
  4. gimp-docs | yesterday 12:46 PM
    GIMP Manual
  5. gimp-user | yesterday 09:42 AM
    Bug

External news

Poll

How good are you at programming?

OMG, that is nothing for me at all!

I've been coding a little bit but I'm not very fit at it

I'm pretty good at programming and would maybe be able to write a Plug-In for GIMP

I'm very good at programming and I would theoretically be able to hack for the GIMP core

See results

Stats

gimpusers.com RSS feed

RSS feed Retweet this!

05 Sep 2007 08:00 AM, by devvv (Bernhard Stockmann)

Perfect masking using a highpass

There are several methods to extract/mask objects or persons from the background. But sometimes you need perfect masking that includes for example the hair of a woman. The method i use for this is called highpass. We need to simulate this filter because there is no filter in GIMP that does this for us. The point of the techqnique is that you'll save lots of time for the difficult hair part, because when you do everything right the hair is extracted automatically.

This article has been written using GIMP 2.4.rc2. It's divided into 8 steps and takes about 30 min to complete for an average user. 155990 times read so far. Category: Techniques, required skill: 3 of 5

41 comments have been posted so far.

Available in other languages:

  1. 1
    Open any picture that contains a big shot of a person / celebrity / whatever. I use a picture of a well known celebrity.
    Screenshot of step 1
    Click to enlarge
  2. 2
    Duplicate the background layer 2 times, you should that layer 3 times then. On the top layer use Filter / Gaussian Blur: 18px. Set the layer to 50% transparency in the layers dialog.

    Then go to Colors / Invert. You should have something similar to my picture now.
    Screenshot of step 2
    Click to enlarge
  3. 3
    Click the right mousebutton on the layer in the layers dialog and choose "Merge down".

    Colors / Desaturate (average). The go to Colors / Curves and apply a soft S-curve as seen on the image below.
    Screenshot of step 3
    Click to enlarge
  4. 4
    Then choose Brightness & Contrast from the same menu. This step can vary when you use a diferent picture. We're aiming to get a good clearly vivisble contrast. Its important thyt you get nice contrast in the hairs area.

    We're now done with the highpass filtering.
    Screenshot of step 4
    Click to enlarge
  5. 5
    Go to Colors / Invert.
    Screenshot of step 5
    Click to enlarge
  6. 6
    Now you need to take a brush and paint the body of the person / object with white. To make it easier to correct mistakes you should create an empty layer above the highpass-layer and paint on this layer, when done merge the layer down. You can move the background-layer above all layers and set the transparency to 20% or so to see what parts you have to paint.

    IMPORTANT
    You don't have to paint the hair! Thats the point of this technique / tutorial. The hair should be already white, and everything behind the hair should be dark gray or black so you dont have to use time to get the hair extracted.
    Screenshot of step 6
    Click to enlarge
  7. 7
    When you have the person white you have to paint the background black. Start at the borders of the body. You can do this fast when you first use a smaller black brush to paint around the person (where the gradient from black to white is visible), and then using a very big brush to fill the rest of the background with black.

    If you use a sperate layer dont forget to merge it down at the end.
    Screenshot of step 7
    Click to enlarge
  8. 8
    At the end you should have an image containg almost only black an white. We use this as a layer mask now.

    Press CTRL+A (Selection / All), copy this using CTRL+C (Edit / Copy). Activate the background where the person is. Click right in the layers dialog, choose Add Alpha channel.

    Click right again and add a layer mask. Press CTRL+V (Edit / Paste) then and use the anchor-button in the layers dialog to get the copy onto the layer mask. You should the see the result immideatly. Make a white new layer behind all, then you can see the results even better!

    Good luck and have fun!
    Screenshot of step 8
    Click to enlarge

This article is licensed under the following license: Attribution-Noncommercial 3.0 Austria

Links (pingbacks)

Comments

Post your own comments, questions or hints here. The author and other users will see your posting and can reply to it. Of course, you can also ask in the chat.

Comments are chronologically arranged.

1 rating(s) with 5.0 of 5 stars in average

  1. http://www.gimpusers.com/tutorials/highpass-masking.html Sat Sep 15 21:45:01 2007 tyewonk, 15 Sep 2007 09:45 PM

    I couldn't finish because Add Alpha Channel was grayed out. My image is set to RGB.

  2. http://www.gimpusers.com/tutorials/highpass-masking.html Wed Sep 19 10:00:47 2007 Kushal Abrol, 19 Sep 2007 10:00 AM

    One of the most useful tutorials ever seen

  3. http://www.gimpusers.com/tutorials/highpass-masking.html Sun Sep 23 11:30:21 2007 anon, 23 Sep 2007 11:30 AM

    rubbish. left me with a total mess. do you honestly thing painting over something will give you good results?

  4. http://www.gimpusers.com/tutorials/highpass-masking.html Tue Sep 25 15:46:52 2007 Anonymous, 25 Sep 2007 03:46 PM

    Awful, simply awful results. Only good for an image with an incredibly neutral background.

  5. http://www.gimpusers.com/tutorials/highpass-masking.html Fri Sep 28 04:04:43 2007 Gimp Fan, 28 Sep 2007 04:04 AM

    Awsome! It worked great following your instructions step by step! Thanks!

  6. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Oct 15 13:49:43 2007 SasQ, 15 Oct 2007 01:49 PM

    I have some questions about this technique:
    1. Which one is better: more blur or less?
    2. What if there are light background fragments left on hair? [on thin hair lines, especially on their ends].
    3. What to do if the background contains hard edges? This technique amplifies them too.

  7. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Oct 18 18:51:40 2007 M.rSnow, 18 Oct 2007 06:51 PM

    Extremely awfull results whit strong backgrounds. extremely meany better ways of doing it. The tool u get when u press [I] is better.(I dont know the name)

  8. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Oct 25 10:38:02 2007 devvv, 25 Oct 2007 10:38 AM

    of course this works best with backgrounds like mine. but nevertheless, this is a common technique in image manipulation, you should know it, its really helpful in some specific situations. of course you may combine some techniques together to get best results.

    however, this is not the typical tuitorial for most of you guys. you're better with manual doing with the bezier/paths-tool.

  9. http://www.gimpusers.com/tutorials/highpass-masking.html Sat Nov 10 14:46:27 2007 Litchi, 10 Nov 2007 02:46 PM

    I think this tutorial is great ! I used it to extract a girl with a lot of hair falling before the background and the result is very satifying. It might work only on simple backgrounds, but it is nevertheless a useful manipulation. Thanks !

  10. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Nov 15 15:58:25 2007 meh, 15 Nov 2007 03:58 PM

    Only useful where the background is neutral enough to select with the magic wand.

  11. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Dec 3 07:25:37 2007 ei!, 03 Dec 2007 07:25 AM

    the tutorial is awesome, but not applicable to all photos... specially those with complicated backgrounds... but its helpful anyway!!>.<

  12. http://www.gimpusers.com/tutorials/highpass-masking.html Tue Dec 18 05:41:32 2007 Rich, 18 Dec 2007 05:41 AM

    This is my second time tring this. and the first time it looked really bad, but I must say if you follow step by step it does really work very well. Thanks

  13. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Feb 28 17:55:50 2008 mulder, 28 Feb 2008 05:55 PM

    nice, don't know thats so simply to cut out the background from an complex image

  14. http://www.gimpusers.com/tutorials/highpass-masking.html Sat May 24 02:38:46 2008 Greg, 24 May 2008 02:38 AM

    This is a very helpful method for certain types of backgrounds. Some people are complaining, but as a professional designer, I can tell everyone that you HAVE to know several different ways to do this. Hair is one of the more complex things to extract from a background. Great tut, another weapon for the arsenal.

  15. http://www.gimpusers.com/tutorials/highpass-masking.html Mon May 26 16:49:33 2008 Alex Railean, 26 May 2008 04:49 PM

    Interesting, but it is not the most efficient way; there is a similar tutorial that explains how to do this by splitting the image to its individual channels and then ehnancing the contrast on the layer where the shapes are distinct (usually one channel has better contrast). By the time you do that, nothing but the object itself is seen - so you get your mask "for free", with no manual actions.

    Unfortunately I can't find that turorial anymore.

  16. http://www.gimpusers.com/tutorials/highpass-masking.html Mon May 26 16:55:29 2008 Alex Railean, 26 May 2008 04:55 PM

    I found it, there you go: http://www.gimpguru.org/Tutorials/SimulatedDOF/

    This is how you obtain the mask.

    And this is how you use it to remove the background: http://www.gimpguru.org/Tutorials/ReplaceBackground/

  17. http://www.gimpusers.com/tutorials/highpass-masking.html Mon May 26 17:03:17 2008 devvv, 26 May 2008 05:03 PM

    yes, i know. this is another efficient way to do this - and a more common way. you should however know all ways to do such things to combine them. not all photos are the same

  18. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Jul 10 21:34:27 2008 doubled, 10 Jul 2008 09:34 PM

    something like this is VERY case sensitive. I think you really need to have a good understanding for the entire program toget good results. Yes, some images are easy to extract, yes some tutorials work for some other images, but you need to have multiple methods.

    I have one method I use for every image but it uses a combination of different masking techniques and explaining it would be near impossible, theres just to many steps.

    What you can look into is Highpass, selective color, desaturation, the pen tool with vector masks/clipping masks, threshold, brightness/contrast, curves, laso tool and color channels.

    for EVERY image i try to extract I use a combination of all of the mentioned above. Some used more then others in different cases, but all of them will be used. Thats how you get a perfect extraction. different parts of the image call for different things.

    read up on all of them and try to understand them. it will help yoy extract images and understand photoshop a lot more.

  19. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Jul 24 07:25:02 2008 Poganka, 24 Jul 2008 07:25 AM

    Great tutorial, thank you! To achieve
    desirable results I had to play with contrast of the BW layer. Actually, ended with maximum. Then I used (gaussian) Blur. Working with four layers I could see the result right away. Thanks again!

  20. http://www.gimpusers.com/tutorials/highpass-masking.html Wed Aug 6 04:10:46 2008 Sarah, 06 Aug 2008 04:10 AM

    can someone help??? i get to the first 2 steps and when i do the color invert it goes greenish blue?

  21. http://www.gimpusers.com/tutorials/highpass-masking.html Tue Oct 7 01:39:10 2008 hrod, 07 Oct 2008 01:39 AM

    I've tried the various extraction techniques,
    They all work with pretty much the same efficency.
    I have even used "select reigons by color". My thing,
    (and i am relatively new to all this) is not so much
    "perfect extraction"( and how do u define this?),but
    how long does it take?, and what must be done after
    the mask is complete.(touch up). so far all methods
    have proven to need touch up.

  22. http://www.gimpusers.com/tutorials/highpass-masking.html Fri Oct 17 17:50:48 2008 Alby, 17 Oct 2008 05:50 PM

    Nice.
    do you know if there is a nice tutorial in italian language to help me in removing people from complicated background?
    Thks
    Alberto

  23. http://www.gimpusers.com/tutorials/highpass-masking.html Wed Oct 29 10:28:42 2008 Dan, 29 Oct 2008 10:28 AM

    You guys should use part of the review of GIMP 2.6.1 over at inatux.com http://www.inatux.com/reviews/GIMP2.6.1review like as a reference, they also have a very good video that might be good for your "Videos" category.

  24. http://www.gimpusers.com/tutorials/highpass-masking.html Wed Oct 29 13:52:31 2008 Wado, 29 Oct 2008 01:52 PM

    Good trick give me more

  25. http://www.gimpusers.com/tutorials/highpass-masking.html Sun Jan 25 18:08:49 2009 Sera, 25 Jan 2009 06:08 PM

    I've used it on some semi-complex backgrounds with no problems and the hair was super long and tight curls in motion. Worked great.

  26. http://www.gimpusers.com/tutorials/highpass-masking.html Wed Feb 18 16:46:44 2009 Toàn, 18 Feb 2009 04:46 PM

    Could the author or someone rewrite steps 7 & 8 with some more details breakdown for GIMP 2.65, because the options are now a little different.
    I have had some success with this, but still not smooth. Thank you.

  27. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Apr 2 10:27:39 2009 Donato, 02 Apr 2009 10:27 AM

    I've done something similar in easier way using Filter -> Edge-detect -> Sobel (GIMP 2.6.5).

  28. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Jun 29 06:22:16 2009 cath, 29 Jun 2009 06:22 AM

    ..the step 6 i dont get it..

  29. http://www.gimpusers.com/tutorials/highpass-masking.html Tue Jul 28 17:23:41 2009 flamingmarsh, 28 Jul 2009 05:23 PM

    it works for me and im a beginner!

  30. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Aug 17 11:20:25 2009 mahvin, 17 Aug 2009 11:20 AM

    You can get the same effects for steps 1 thru 5, in 3 quick steps using 2.6.6.

    1. Run Filters - Enhance - Adaptive Contrast

    2. Desaturate - average

    3. Colors - Invert

    I would then add a new layer, use the Free Select tool (lasso) to select the inside edge of Jolie's body on the new layer and fill it with white. Then use Select - Grow to expand the selection just outside the outline, invert it, and fill the background with black. These two steps would save you a lot of time

  31. http://www.gimpusers.com/tutorials/highpass-masking.html Fri Aug 21 22:16:35 2009 Toàn Pham, 21 Aug 2009 10:16 PM

    Donato & Mahvin, I really hopefor your guys's help with a bit more explanation as I am a beginner at this (and need to get some pictures cut our with lots of edges and hair for a brochure). I think the Edge-Detect > Sobel is good, but what next. Please help with the details. I am really needing a little more help!
    Thanks!

  32. http://www.gimpusers.com/tutorials/highpass-masking.html Sat Aug 22 21:44:54 2009 Rada, 22 Aug 2009 09:44 PM

    Everything went just fine up to step 8, but then the instructions become very unclear. I could not go further, but I am a beginner with GIMP.

  33. http://www.gimpusers.com/tutorials/highpass-masking.html Sun Aug 23 12:04:48 2009 mahvin, 23 Aug 2009 12:04 PM

    @ Toàn Pham:

    I'll work on a newer version of this tutorial sometime this weekend and post it on my blog at mahvin.com. I don't want to hijack Bernhard's tutorial, but it does need to be updated since GIMP versions and scripts have improved since September 2007.

    One other reminder: this technique only works with certain types of pictures, that don't have a busy background.

  34. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Aug 24 17:21:09 2009 Toàn Pham, 24 Aug 2009 05:21 PM

    Mahvin, Thanks - Bernhard's tutorial gives a good background on this, but an update and additional details so that beginner can follow would be soo nice. Yep, the busy background would actually not be a problem, since we can just hand clean most of it out. The real work is the edges around the main image with hair and all. Thanks & look forward to it!

  35. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Oct 22 02:40:00 2009 Danny, 22 Oct 2009 02:40 AM

    I'm new to GIMP(v2.6.7) and was able to follow along up to Step 8. I am completely lost at step 8 when directed to add a layer mask. At that point I can't follow along. Screenshot: http://s135501958.onlinehome.us/Step8.jpg

  36. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Dec 7 03:30:38 2009 clinton, 07 Dec 2009 03:30 AM

    You are doing two things: adding an alpha channel to your background layer (the one with the person you are cutting out) and then you are adding the black and white mask you just drew. The alpha channel is the fourth "colour" in RGBA which represents how transparent a pixel is. With the mask you just made, you are actually drawing the alpha channel you want, where black is completely transparent, and white solid. So step 8 is telling you to copy your mask to the clipboard (select all and copy), add an alpha channel to your RGB background layer by right-clicking on it in the layer-selector and saying "add alpha channel". Finally, add a mask for your background layer (poke around, don't have Gimp installed right now!) and paste your mask into it.

  37. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Dec 7 03:33:08 2009 clinton, 07 Dec 2009 03:33 AM

    Yeah, and what you "initialize" the layer to just means "how do you want to start to draw your mask" and it doesn't matter what you pick because you already have a mask you're going to paste in anyway.

  38. http://www.gimpusers.com/tutorials/highpass-masking.html Mon Dec 7 03:45:52 2009 mahvin, 07 Dec 2009 03:45 AM

    @ 37. clinton:

    Exactly! You're just setting up the original layer to be "mask-ready", and then pasting the black/white layer into that mask ready "place-holder" (for the lack of a better term in describing it).

    In laymen terms, just look at adding a mask to a layer as "opening the box flaps" so you can paste the actual mask "into" the theoretical box. Once you paste that mask into the original layer, you don't really need the black/white layer anymore because as Clinton explained @ #36, by pasting it into the original layer with alpha channel and mask layer, you have essentially hard-wired your transparency ranges into the image.

  39. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Jun 24 00:50:50 2010 Garmahis, 24 Jun 2010 12:50 AM

    This tutorial is featured on 70 creative Gimp tutorials
    http://garmahis.com/tutorials/gimp-tutorials/

  40. http://www.gimpusers.com/tutorials/highpass-masking.html Sat Jul 10 09:57:43 2010 Intermediate, 10 Jul 2010 09:57 AM

    As said above, it works best with neutral backgounds. However, I used it for a picture of my mom in a kayak with the city surrounding her (all I wanted to do was gaussian blur around her so she's the focus point) and with a little bit of extra technique added (actually, quite a bit of extra) I came out with a close to perfect mask. So I think if you know what you're sorta doing with the gimp, you can come out with an acceptable result.
    HOWEVER, if my goal was to cut her out and put her on a white background, it would not have turned out as well. So it all depends on the picture and what you're using it for. I will definitely try to remember this teqnique, and use it in the future.
    A big thanks to the author!

  41. http://www.gimpusers.com/tutorials/highpass-masking.html Thu Aug 26 05:42:00 2010 Jess, 26 Aug 2010 05:42 AM

    It worked okay, but it left a small border around the image of the original (though it is a uniform border) I can see this being okay for things where the context of the image isnt important, you just need a cutout for say, a flyer, but not if you wish to move the image into another background and it look natural or splicing things together

Registered users can log in (top right of the page) to use their profile name to post comments, request email notification on new comments and attach images (e.g. their versions of the effect) to their postings.

Are you human?

Adobe® Photoshop® is a registered trademark of Adobe Systems, Inc. Linux is a trademark of Linus Torvalds. Ubuntu and Canonical are registered trademarks of Canonical Ltd. | Clock times are shown as CET / CEST | Imprint / Privacy policy | powered by bitfire it services | sponsored by Hirners Hotel Guide