enter image description here

Sample input

enter image description here

Sample output ("Yellow channel")

enter image description here

Sample use case (Color exchanging)

This should not be RGB/CMYK-related but color-related. I want to generate a color channel of the specific color I select, and that color channel should consider the lights and shadows of that color only.

This answer is very helpful with CMYK colors, but it's difficult to reproduce with other colors, however, I think that's the way to follow, but with more intelligence and generalism (Replicable with any color).

NOTE: Solution can be on Photoshop, Website (If free), GIMP, or even the Linux Command Line.

  • Yes it's possible and a very common thing to do actually. I want to answer this, but your question is quite broad. Don't know where to start ... I need to go search for good example images first. Perhaps it would be easier if you had something you wanted done.
    – Wolff
    Nov 12, 2020 at 18:07
  • Try doing it with the Yellow light on the girl planet image. This way I can see the process for non-R/G/B colors. — Just leave all other things as alpha.
    Nov 12, 2020 at 18:10
  • Hi. What exactly are you trying to do here? Not sure I understand this question at all. Are you trying to remove the black background? At the moment your question reads like an XY Problem. Maybe think about what you want to do specifically, and describe that, instead of trying to describe a method to do it.
    – Billy Kerr
    Nov 12, 2020 at 19:29
  • Hi Billy, your XY article was helpful, but I'm not that kind of person. This problem is very generic to any image or specific manipulations, so if I give a problem with an image doesn't mean that will be the solution for other images as well. I will post my closest solution soon, but sadly it doesn't lead with more than primary and secondary colors, however, the range is as detailed as information could contain the image.
    Nov 13, 2020 at 8:56
  • The XY problem isn't about "a kind of person". It's about questions that focus on a solution rather than the actual goal. Your question needs more details or clarity, so unfortunately I'm voting to close it. Sorry about that.
    – Billy Kerr
    Nov 13, 2020 at 9:41

3 Answers 3


There are so many different ways to do this. Different images respond well to different methods, so it's good to have a whole arsenal of different approaches. I can't show them all here, so I'll just give you one example.

Separate yellow with Black & White adjustment

If we can create a grayscale image where everything yellow is white and everything else is black, we can use that image as a Layer Mask on the original image.

First I exaggerate the colors of the original image with a Vibrance adjustment layer:

Then I add a Black & White adjustment layer where I turn down all other colors besides yellow which I turn up a little bit.

As you can see the color yellow is present to some degree in anything besides clean blue tones and black. Furthermore some compression artifacts have become visible (a better image would give a cleaner result), so I add a Levels adjustment layer to clean up the image a bit:

Now I can Select > All and Edit > Copy Merged to copy the resulting image to clipboard.

If I create a Layer Mask on the original image, Alt + left click the mask and paste in the resulting image, it manages to somewhat make everything besides yellow transparent.

Here it is with a black background:

This is an aesthetic exercise. There is no "scientifically correct" method or rather that would probably not give you the result you want. Every step I show here can be tweaked to your liking.

Other things to explore

  • The grayscale image created with this method could of course be inverted to have the opposite effect or used as a layer mask on some adjustment layer. For example to desaturate everything that isn't yellow.
  • A Channel Mixer adjustment layer could be used instead of Black & White to mix a grayscale image.
  • A Hue/Saturation adjustment layer could be used to boost specific hues before the Black & White adjustment layer.
  • A Selective Color adjustment layer could also be used to alter the image before the Black & White adjustment layer or used on its own to filter away unwanted colors. It can be duplicated to enhance the effect.
  • Select > Color Range is a whole other way of selecting colors in a specific range.

Extracting Colors from an Image


enter image description here

Sample input

enter image description here

Sample output ("Yellow channel") (gray background to see details)

enter image description here

Sample use case (Color exchanging)

0. Depth

As colors are the focus of attention in this kind of workflow, please ever set the 16 bit color depth mode AT THE MINIMUM before any manipulation, and make sure to work in a copy of the original layer only.

Image > Precision > 32 bit integer

1. CMYK Decompose

When working with this image, we will take out the YELLOW color, so for practical reasons the CMYK Channels will be more useful than other methods, however, being this extracts out the light-information channel K, it's better to use it even for RGB colors instead.

Select the original layer > Layer > Duplicate Layer
Select the duplicate layer > Colors > Components > Decompose...

Color mode: CMYK
Decompose to layers: YES


2. Select your color, and select it well

You will notice there is a lot of artifacts all around the first three layers, however, the black layer is which has the biggest amount of detailed information as it comes from the combination (and not sub-product) of the three RGB channels we had. Please hide and show the layers as you use them to better understand what's happening.

enter image description here

As we only need the yellow, and in all those layers the black means "it has not that color" while white implies "full of that color", we need to "clean" the non-yellow "channels" as follows:

Set your background color to black
Select the cyan layer
Edit > Fill with FG color Select the magenta layer
Edit > Fill with FG color

As an exercise, we will compose the image at this point to take a look at why is his wrong at this state.

Colors > Components > Compose

enter image description here

As white is a combination of all RGB colors, there is no information about the difference between a bluish-white and a reddish-white. It's just X-Level of lightness, and the colors is on other channels.

This means this composition has lights of colors that aren't yellow, which means if we convert all blacks to alpha we will get visible white artifacts:

Colors > Color to alpha

Color: #000000
Transparency threshold: 0.000
Opacity threshold: 1.000

enter image description here

White zones given from non-yellow bluish-withes

The solution to this is almost simple, and for this the CMYK Decomposition is key. If we have all pixels with whites and we only need pixels that has yellows, how can we rest the pixels that are not in a yellowish zone?

Multiply Mode:

Multiply mode multiplies the pixel values of the upper layer with those of the layer below it and then divides the result by 255. The result is usually a darker image. If either layer is white, the resulting image is the same as the other layer (1 * I = I). If either layer is black, the resulting image is completely black (0 * I = 0).

As we have Black and White images, we can multiply our yellow layer with the black layer to dark all zones of black where is no yellow color. For this we need to invert black because is same as an light layer inverted (the whitest, the more black tint will blend), while CMY are colors, so the absence of color is white. Remember we are working with RGB values over CMYK "channels":

Select the black layer
Colors > Invert (You now see a lightness layer)
Select the yellow layer
Layers > duplicate
Put it on top of the black layer
Change its blend mode to Multiply
Layers > Merge Down

You have reached a lightness channels for yellowish-pixels only. It should look like this:

enter image description here

See how completely white zones are overridden. This is because white is not a color itself. It's (in CMYK) the absence of it (because papers are white).

Now revert the state of the black and recompose:

Select the black layer > Colors > Invert
Colors > Components > Compose (Defaults should be ok)

enter image description here

4. Use it

How you use this result depends on your needs, but as before, I would convert it to alpha with Colors > Color to alpha as this is simplest and quick (And I don't know how to replicate that result with layers):

enter image description here

For the example above, I have changed its hue, putted it on top of the original image, then set its blend mode to LCh Color:

enter image description here


With this workflow you can process Cyan, Magenta, and Yellow colors easily, however, if you want to process Blue, Red, Green... for example, you will need a mix of layers. This is good news and bad news because you can see the CMYK values of whatever color you want to extract and distort the amount of white of the CMY layers in proportion, then multiply them all over the black channel. But it's as time-consuming as precise.

This is a very viable way to literally modify the lights of an scene with lots of reflecting objects, just like changing the lamp or its properties, with a layer. Same with colors of objects, without the need of paths or selection tools.


My solution:

First: Select the desired color with Select -> Color Range ... by holding shift and click we can add the colors we are interested in.

Second: Because the selection is on dark background we need to use Blend if in the layer options. Adjust by eye.

Third: Add an Hue/Saturation adjustment layer to change the color.


enter image description here

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.