Jump to content

How to select hair?

Recommended Posts

In the near future I´ll be working on photo mounting selecting women from a background onto another, such as these examples:





The photos will have an original background in natural environments, so not like the 2nd and 3rd example. On Youtube I only find many videos for Gimp and Photoshop but not on Paint.net. Is there any solution planned or a plugin available?


Thanks in advance!

Link to comment
Share on other sites

Good luck. It doesn't matter if you used Photoshop, Gimp or PDN, You will still have a lot of work ahead. Generally when these type of things are needed, the model is shot against a solid, properly lighted green screen background. Everything else will be a compromise. 


Link to comment
Share on other sites

@ racerx

It´s not the fact to have a lot of work, I need a general "how to" to get a solution to start with.



We have plugins that can do some of what photoshop can do. Do you have any tutorials you liked? Maybe if I watch them I can suggest paint.net alternative methods and plugins.

Thank you for this input. Here is an interesting example: How would you do this in paint.net? Thx in advance.

Edited by Saitentanz
Link to comment
Share on other sites

Different methods that I use (sometimes in conjunction, sometimes by themselves) are:

- Magic Wand the background, play with the tolerance level so you're not selecting any of the hair, and hit delete. Then you zoom in and select all the places you've missed, deleting one at a time. Having a pink background layer is pretty nifty to see what you're doing, as opposed to the empty checkered background.

- Duplicating the image and then using Color Threshold until the portrait becomes entirely black. Then you Magic Wand the white part, select the bottom layer, and hit delete. Deselect the top layer (which you shouldn't need again but don't delete it just yet, just in case). Just like in the previous method, you zoom in and select all the places you've missed, deleting one at a time.

If there's an easier way, I would LOVE to hear it (I'm not being sarcastic here, I'd really love to hear something faster and easier). It's a lengthy process whatever you do.

Link to comment
Share on other sites

The PhotoShop tut uses an easy example because the background is already white. You can duplicate all the steps in that tut using Paint.net. Make your mask (black + white) and use "Alpha Mask" plugin to import your mask.


Quick example:



Edited by racerx


Link to comment
Share on other sites

Hi. Thanks for the video. That video is perfect, I was hoping we had the same idea in mind, it makes explaining easier. I have seen videos for that method myself, and have been playing around with it, so I do know a few plugins that might help.

When removing a subject from it's background, you will want to duplicate the image. I often don't like to change or edit the original, so I duplicate twice. One layer stays untouched and invisible (Original Layer), one layer will be the layer I cut the subject out from (Cutout Layer), another layer is what I turn into a mask (Mask Layer).

To some-what mimic the video, you will want to make a mask of your picture. (duplicate the picture, and turn it into a silhouette)
The video turned their picture into a mask by first using channels to choose the channel that had the most contrast. It then used the Levels Adjustment to adjust the contrast more. Paint.net has the Levels Adjustment, and channel plugins, however, for making a mask, there are also other plugins that can give different or better results, depending on the picture you are working with.

Here are some plugins you can try and experiment with :

The Extract Channels plugin is part of this plugin pack : http://forums.getpaint.net/index.php?/topic/18811-ed-harvey-effects-v-35-2012-02-13/

There is something called Color Channel Mixer, but I don't remember what it does : http://forums.getpaint.net/index.php?/topic/14522-color-channel-mixer/

The Gradient Mapping plugin surprisingly can give good contrasting results : http://forums.getpaint.net/index.php?/topic/6265-gradient-mapping/

My favorite plugin lately would have to be the Two Tone Threshold plugin : http://forums.getpaint.net/index.php?/topic/29450-two-tone-threshold-new-30th-july-2014/

Aside from using plugins and the Levels adjustment, paint.net also has the basic Black and White Adjustment and the Brightness/Contrast adjustment, sometimes for simple pictures, they're all you need. (They are located under the Adjustments Tab)


Important Note. To make your subject a completely solid color, but keep the hair clean and not coarse as the video called it, you can use the paintbrush. Use adjustments and plugins to get your hair looking good, then for making the rest of the subject into a solid color, color it with the paintbrush (the video mentions this too). There is also the line/curve tool if you are poor at doing things free-hand.

After you have a silhouette/mask of your picture, I can suggest two ways of removing the background from your picture :
Use the Magic Wand on Global Flood Mode to select the background on the Mask Layer, then for visual reasons turn the Mask Layer off. Click on the Cutout Layer and hit delete on your keyboard.
I personally don't always care for the results of the Magic Wand, so an alternative is to use the Alpha Mask Plugin. The Alpha Mask plugin works both with masks on your clipboard and it can import masks.
To use the plugin with the clipboard option,
-- Make a mask of your picture.
-- Copy your mask (ctrl + c), and for visual reasons turn the Mask Layer off.
-- Click on your Cutout Layer and run the Alpha Mask Plugin.

If you have questions, feel free to ask. :)

Edited by Cc4FuzzyHuggles
Link to comment
Share on other sites

You might try the HSV Eraser plugin I wrote. For an image with a highly contrasting background, like the PhotoShop example, it would probably work quite well. The plugin's "Portion of Non-Erased Color to Preserve" control is another way of handling the white fringing. When that value is set to 1, erased pixels are made transparent in relation to how nearly they match the Match Color. The Clone Stamp method used in the video seems a bit crude to me. The reason there are fringes is mostly due to the fact that there aren't just hair and non-hair pixels; there are pixels that are part hair and part background. Making them all-hair pixels results in a somewhat clumpy look to my eye.

If you use the HSV Eraser, you can't generally just run it on the image, since there are probably interior foreground pixels that match the Match Color. One method I suggest is:


- Add a new lowest layer, and set the entire layer to a contrasting color so you'll be able to tell what's erased..

- Duplicate the image.

- Make the middle layer invisible.

- In the top layer, use the Magic Wand, the Eraser, and whatever else you want to erase the background and all the areas that might be either background or foreground. It's better to leave the foreground as intact as possible, but no great care is necessary. When in doubt, erase! The purpose of this layer is to replace foreground pixels that are removed by the HSV Eraser. It will be the topmost layer and visible while you use the HSV Eraser on the middle layer.

- Make the middle layer visible again and make it the active layer.

- Select the background color you want to remove as the Primary Color with the Color Picker.

- Run Adjustments>HSV Eraser.

- Set "Portion of Non-Erased Color to Preserve" to 1.

- Set the Match Color source to User Match Color. Press the User Match Color reset (the arrow button) to set it to the Primary Color.

- Adjust the tolerances and perhaps the Match Color. Sometimes it's better to make the Match Color further way from the hair color, even though it may no longer quite match the background. The Match Color should not be adjusted to be too far from the background color, however, as the method of preserving the non-erased color depends on knowing the background color mixed into the pixel. In the example below, I set the Match Color to white even though the background is off-white. Hopefully, you'll find values that will erase the background but leave the hair.

-When satisfied, merge the top two layers.

-Also, as general advice, keep in mind you only need to worry about the pixels near the edges of the foreground and background. Pixels away from the edges, clearly within the foreground or background areas, are easy to fix up.


Here is one of the pictures you posted, against a green background:


Edited by MJW
  • Upvote 1
Link to comment
Share on other sites

MJW's idea of using a color removing plugin is a good idea.


If it interests you, I have previously given brief ways on how to cut out objects from their backgrounds, maybe one of the ways mentioned will be helpful to you. 

Here is a link to my old post :


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...