11

I have a picture (File format: JPEG | Сolor depth: 24):

enter image description here

I'm using Adobe Photoshop CC (2015.5.1). I need to change background color from grey to pure white [#FFFFFF / RGB(255, 255, 255)]


Firstly, I did it using Magic Wand Tool. I selected background area with it and then applied Paint Bucket Tool. I filled it with white color.

Selected this way:
enter image description here

Result after filling : enter image description here

That is untidy. Some hair is cut. Background-to-hair transition bounds are sharp. It's not what I want.


Secondly, I switched to Color Replacement Tool. Using Eyedropper Tool I selected background color and set white for replacement:
enter image description here

But it replaces background color to grey (not white). This "white" color is kind of transparent or extremely unsaturated. I will show it on the example of Blue color (grey changed to grey is unnoticeable).

Colors: enter image description here

Result: enter image description here
Instead of real blue (dark) color I get this kind of transparent, unsaturated blue.


Question: How to change background color properly? First method is quite untidy. Second method changes colors more accurately (without hair cuttings), but colors are "transparent". How can I change background color to pure white?

  • Possible duplicate of How do I easily remove an almost-white background? – Ilmari Karonen Oct 9 '16 at 12:41
  • 1
    @IlmariKaronen Agreed, although that doesn't show an example with hair, which is the tricky part. – mattdm Oct 9 '16 at 16:30
  • 1
    Welcome to Photo.SE. This is an excellent question, clearly detailing what you are trying to achieve, and what you have tried. And the fact that it has generated (at least) 2 good answers with practical approaches to get your desired results, makes this question even better. – scottbb Oct 9 '16 at 22:09
12

The color replacement tool isn't working for you because its default mode is "Color", which changes hue and saturation, but not luminosity (brightness/value). That's why you get the blue or the gray→gray effect. Changing this the tool's mode to Luminosity may get you what you want. I don't have Photoshop, so I'm not the best-suited to answer that.

For an alternate way to get the result you want, Ryan's answer is great and I definitely recommend that masking approach. However, I want to show how you can get pretty good quick results with just fuzzy select and the Curves tool rather than paint bucket.

The example is in Gimp, but uses tools that you should be able to find in pretty much any program.

First, use the "magic wand" selection tool with a very broad threshold (here, about 60):

select

Then, Grow that selection — the goal is to cover all of the places where gray shows through the hair but not get too much of the face:

grow

grown

Then, use the curves tool. It's easier to see what you're doing in logarithmic view mode...

curves tool

... and draw a curve like this, smashing all of the extreme almost-white highlights to pure white, and bringing up the rest very aggressively:

curved

This leaves the corners a little bit of a bluish off-white, so repeat the fuzzy select, clicking in a corner with a much lower threshold (10, 11, something like that). Make sure "feather edges" is selected with a relatively high radius.

corners

And then use the curves tool again, this time even more aggressively (since none of the actual subject should be affected):

curves for corners

This gives a result like this:

the quick result

... Which isn't as good as Ryan's, but can take less than a minute and requires very little care, and is noticeably better than the Paint Bucket Fill approach.

If your final result is going to be scaled down (for web viewing, for example) I'd just use this approach. If you need the detail, create a hair mask as Ryan shows.

14

Graphic Design Stack Exchange: How to cut how hair accurately

Advanced hair extraction tutorial

First off, plugins and simpler methods are available. This is if you want to get higher quality results.

I'll be using this photo from Photo by Ariana Prestes on Unsplash.com:

Original Photo

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:

Green Channel

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:

Apply Image Overlay

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:

Apply Image Overlay again

Then go into Curves (Ctrl/Cmd+M) and adjust the White and Black point sliders.

Curves Adjustment

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:

Mask after Apply Image Apply Image Curve

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:

Burn Hair

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:

After filling it in

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.

Dodge the White

Then fill the rest with White.

After filling the White

And let's see where we're at in the 100% view:

Completed Mask

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

Refined Edges

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:

Finished Image

And our 100% crop this time looking at the original vs the finished:

Hair Cropped on BG Image

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:

Final comparison

Not bad for a Mask from a JPG.


In your case once you learn the technique it shouldn't take more than a few minutes. Without using my Wacom I pushed the colors, created an alpha mask, burned the inner portion, and dodged the outer portion then used it as a mask for a simple curves adjustment.

enter image description here

-2

Grey is not a colour; it is a step along the line of zero hue (that is, the black↔white line). You can't use a colour modification tool to change "dark white" to "normal white", because the hue is the same in both cases.

Before proceeding with your photo manipulation, you should read up on the difference between Hue, Saturation and Brightness. Then you will be ready to adjust these values independently to achieve your desired results.

  • 1
    There's already a substantial answer on how to achieve the OP's goal, but I felt a broader perspective on the original assumptions might be helpful as an addendum. – Lightness Races in Orbit Oct 9 '16 at 14:41
  • 1
    Hi, your theory is correct but the application is wrong. What I mean is your second sentence is not accurate; you can use the Color Replacement Tool to change a Gray to White. – RyanFromGDSE Oct 9 '16 at 15:42
  • 1
    It's also a language issue; gray is only not a color in a certain technical definition of color (where you are basically defining color to be "chroma"). In plain English, gray is certainly a color (or, grey is a colour, if you prefer that English), because color encompasses all variants of hue, chroma, and value. – mattdm Oct 9 '16 at 16:32
  • @RyanFromGDSE I don't have Photoshop; can Photoshop's Color Replacement Tool work on value/lightness as well as hue? – mattdm Oct 9 '16 at 16:33
  • I tried Gimp's Color Exchange tool, but it isn't well-suited to the task, since it has per-channel threshold values but no "spacial" thresholds and no ant-aliasing; there's no way I could reproduce the result in the example with it. – mattdm Oct 9 '16 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.