In this example i would like to turn the background white and when you look at the scattered hair it obviously is really hard if not impossible when using the magic wand tool. The magic wand tool does not make the cut. Since it is quite clear that there is the contrasting regions of dark (hair) and light region (background) i was wondering if there is a tool or function in GIMP to lighten the obvious contrasting region like a binary function that detects either light or dark area and applies the tool to either the dark or light area and do a certain color function on this region (i.e. turn light region to white or another color). Currently my methodology is to turn the saturation to zero of the selected hair region and use the brightness/contrast tool but it does not always work out well (example if hair is not dark) and there is loss of hair sometimes. In this example it works out. So far this is the best method i've found and used better than magic wand.
-
These days this is an AI function you can do for free online. Even Adobe provide a free front-end for this - express.adobe.com/tools/remove-background– TetsujinApr 12, 2022 at 7:53
-
it's nice that it's free unfortunately it doesn't do a good job in this scenario. alot of hair was lost.– Harry McKenzieApr 12, 2022 at 8:37
-
2The problem ha been up many times in GDSE. Hair looks generally darker than the BG, but there's so much exceptions that no brightness treshold is the right one. You have already found this. Working software would understand the image content like your sight does, but GIMP decides the pixels separately which is useless in this case. The classic method to overcome the limitations of the pixel by pixel decision is to think it before the image was shot. High resolution sharply imaging camera, proper lights and distant enough bright and uniform background are essential.– user82991Apr 12, 2022 at 8:37
-
1(continued) I have had numerous times in my hands images shot by people who cannot understand why a single click background removal doesn't remove the BG nor save the hair., no matter they have tried to have a light wall behind the target person. As a workaround (when rejecting the job is not a viable option) I have sometimes drawn manually some hair or copied it from another image.– user82991Apr 12, 2022 at 8:42
-
@user287001 thank you for your input, yeah you are absolutely right, unfortunately my customers would always do the same mistake of making bad pictures and i have to do the heavy lifting XD i guess i'll have to stick to my current methods then for now. i was just curious if there was a better method.– Harry McKenzieApr 12, 2022 at 8:46
1 Answer
The photograph looks quite poor quality, so it might be difficult to do this. I don't know how much time you have to invest in the edit, but it might not be worth your while on such a poor quality image. Phone camera lenses can produce that kind of low contrast effect if the lens is dirty/greasy. Maybe encourage them to clean the lens before taking the photo. Also with most phones the back camera is usually better than the front camera. Maybe ask them to get someone to take the photo instead of trying to take a selfie. It's always better to try to get the best quality image possible from the camera before editing.
GIMP has a foreground select tool which may work in some cases, but it will probably fail on your image because it needs some contrast to work well. There are tutorials on youtube if you want to try that route. I also answered a question here which describes the basic steps. It also works on wispy hair
Anyway it is possible to create a nice layer mask manually from an image that has a lighter background and darker wispy hair.
Go to the Channels panel, and right click the channel which has the most contrasty image, and do Channel to Selection. Then back to the layers panel, add a layer mask and choose the option to create it "from selection", and hit the "invert" option.
You'll get something like this as the mask.
- Next apply curves to the mask, a nice S-curve will usually do the trick. the idea here is basically to increase the contrast a bit.
- With a medium soft edge brush set to normal mode, and white, paint inside the mask making sure not to go near the edge
- Set the brush to Overlay mode, and bring down the opacity to something like 30%. Then set the foreground colour to white. Paint over the hairs at the edge to brighten them up. Then switch to black and paint over the background to make it darker.
Something like this. You can take more time than me perhaps
Here's the result, toggling the mask and background on and off
-
cool thank you i shall try this one out, this will help me for future edits i will make :) Apr 12, 2022 at 12:02