I use the Pen Tool for 90% of the situations where I need to cut someone or something from a photo but sometimes it gets tricky, especially when it comes to hair.
Let’s take the following image for example:
- Pen Tool – don’t even think about it, it would take years to do an accurate cut so you usually do a more bulky cut.
- Magic Wand & Quick Selection Tool – in some cases these can work, especially if you know your way around with Tolerance and Refine Edge
- Blending modes are very useful in some situations also
When confronted with such an image I usually do use one of the tools from above + get something like 10 color samples from the hair, create a new brush that I adjust from photoshop’s brush engine and start drawing hair.
From everything I’ve tried, redrawing hairs gave me the best results so far.
Q: Is there a better way to get an accurate selection when cutting hair? Or, how can I improve what I’ve got so far?
PS: Just wanted to add that a situation where the background behind the subject is in a single color like in the sample I offered is rare, therefore an answer based entirely on same color selection won’t help that much.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Advanced hair extraction tutorial
First off, plugins and simpler methods are available. This is if you want to get higher quality results. It is largely the same as ACEkin’s answer except going into details and with visuals.
I’ll be using this photo from Photo by
Ariana Prestes on Unsplash.com:
Note: I’m going to be doing the body in a separate layer so I’ll be ignoring it for most of this tutorial until the final few steps
Select the Channel with the most contrast in the fine outer hairs. I think Green is the best option:
I’m going to duplicate that channel and rename it to Hair Mask. This will be what I work on until otherwise stated.
Important: If your hair is light on a dark background then you need to invert some of this as far as when to Dodge/Burn and when to use Black/White.
Now to start Apply Image. Multiply or Overlay are good options, sometimes you can even Apply Image twice. Here I applied the Hair Mask to itself with the overlay and lowered the opacity in the settings a bit to not lose the really fine hairs:
I actually did Apply Image Overlay a second pass with a lower Opacity pushing the contrast a bit more. This isn’t undoing the first one, its doing it a second time:
Then go into Curves (Ctrl/Cmd+M) and adjust the White and Black point sliders.
Setup some Guides so I could periodically show original vs current at 100%. Here’s the first look after just doing Apply Image, Apply Image, Curves:
Now you can like ACEkin said use Brush set to Overlay. I prefer starting with Dodge and Burn though. Burn set to Shadow and I used Exposure of 12 then went over the hairs as carefully as possible. The more careful and time you take the better the results will be. This was maybe 3 minutes, not long at all:
Then at this point go ahead and switch to Brush, Black and fill in the inside. If you want you can first do Black set to Overlay and make another pass at the edges. Again, more time you take the better the results:
Alright, now use Dodge on the spaces between the hairs. Brush set to Overlay White is another option, again I prefer Dodge and Burn. I did Dodge Exposure 12 on Highlights.
Then fill the rest with White.
And let’s see where we’re at in the 100% view:
With your completed mask selected go back to RGB channel and then layers and apply the mask. I did the body with a separate layer as I mentioned earlier so now I’ve applied that as well.
Then just refine your mask using the Refine Edge command be sure to use Decontaminate Color
Now the background I picked doesn’t really match the lighting and picture, but that’s alright. Its not about whether the picture looks real, just about the mask. Could almost always take more time, this is by no means perfect, but here it is which is pretty good for the point of teaching the technique:
And our 100% crop this time looking at the original vs the finished:
I didn’t really think about the crop area when choosing a background image to drop in. Since its hard to see that particular area, here’s with absolutely no changes to my mask, just got rid of that background for a plain white background for the comparison instead:
Not bad for a Mask from a JPG.
This is best done by selecting an area close to but not intruding the hairline touching the background. Then adding a mask and refining the mask is the best method for separating the hair from the background.
For the initial selection, you may consider choosing a high-contrast channel, duplicated it, and using the brush in the Overlay mode, paint the outside with white and inside with black. That will also give you a good starting point. You will still need to refine the mask but this second method may get you closer to the actual selection. For the critical parts you may need to manually paint the areas in the quick mask mode so that you can see the image while refining it.
Please realize that this is an extremely condensed explanation of a tedious process.
You can start by selecting the background by color and tweaking it with a brush in Quick Mask, but in my experience I’ve never had very good results doing this by hand. Even if you carefully mask around each hair you still get a lot of bleed through of the old background. I usually just clip out the fuzzy hairs and that’s usually good enough for small format, low-res stuff.
There are photoshop plug-ins that can do this for you quickly and easily. I’m not a professional retoucher, but I am a working Art Director and I’ve never been able to do as good a job as a these plug-ins for photoshop seem to be able to do, though I’ve never actually used on.
You also might consider the plug-in if the focus of your work will be on the hair. i.e. This will be in an ad for hair products or it’s a full page ad that’s zoomed in the hair and it would look sloppy if you just clipped out the details.
If don’t mind spending money a plug-in will do it easily and better than you can by hand. Here’s one plug-in I found doing a quick google search: https://www.topazlabs.com/remask