Please help me to understand "Channel Mixer"

Based on @patdavidā€™s explanation above, if I understand correctly:

Increasing the red slider in the red channel:
boosts the red channel (making the resultant image more red) based on the tonal information in the red channel itself.

Increasing the green slider in the red channel:
boosts the red channel (making the resultant image more red) based on the tonal information in the green channel.

Iā€™ve not done the second type of operation myself, but I imagine itā€™s often a subtly different way of controlling colour. The more the green/other channel differs from the red/adjusting channel, the more different it will be.

Itā€™s not blue thatā€™s added to the red channel, but a portion of the blue channelā€™s tonal data/numbers. (The portion/amount added is controlled by the slider.) And so the red channel is increased as compared to the blue (and green) channel.

2 Likes

@tstoddard - donā€™t get too caught up in the idea of color models/spaces just yet. It can be counter-intuitive to wrap your head around but at the end of the day the biggest things to keep in mind is

adjusting each channel in the mixer (red, green, or blue) will only adjust how ā€œbrightā€ that particular color is.

You wonā€™t be adding any other colors into the mix. The channel mixer only letā€™s you adjust how intense that particular color is.

Hopefully I can clear this up. Letā€™s consider four ā€œpixelsā€ that are only made up of a Red and Green channel (weā€™re ignoring Blue for the moment to simplify things) that go from 0 ā€“ 255.


From left to right, we are going to set their initial Red, Green values as:

First: 127, 0
Second: 127, 64
Third: 127, 127
Fourth: 0, 127

So, letā€™s look at modifying only the Red channel in the channel mixer. Iā€™m going to use GIMP for this example but the theory should be the same everywhere.

So on the Red channel, letā€™s push the Green contribution up to ā€œ50ā€.

What I would expect from this is to take the Green channel value for each pixel, multiply by 50%, and then add it to the Red channel.

First Pixel

So letā€™s look at the First ā€œpixelā€.

Itā€™s values are R = 127 and G = 0. Soā€¦

  1. Multiply Green channel value by 50%:
    0 Ɨ 0.50 = 0
  2. Add the result to the Red channel value:
    127 + 0 = 127

The final result of this operation on the pixel will be nothing:
R, G = 127, 0

Second Pixel

The second pixel has something interesting finally happening to it.
Remeber, itā€™s values are R = 127 and G = 64.

  1. Multiply Green channel value by 50%:
    64 Ɨ 0.50 = 32
  2. Add the result to the Red channel:
    127 + 32 = 159

The final result of this operation on the Second pixel will be:
R, G = 159, 64

Third Pixel

The third pixel has itā€™s values as R = 127 and G = 127.

  1. Multiply Green channel value by 50%:
    127 Ɨ 0.50 = 64
  2. Add the result to the Red channel:
    127 + 64 = 191

The final result on the Third pixel is:
R, G = 191, 127

Fourth Pixel

The fourth pixel has no Red in it: R = 0 and G = 127.

  1. Multiply the Green channel value by 50%:
    127 Ɨ 0.50 = 64
  2. Add the result to the Red channel:
    0 + 64 = 64

The final result on the Fourth pixel is:
R, G = 64, 127

If we actually do this in GIMP, we see that this is exactly what we get (notice that the Green channel hasnā€™t changed at all in this only the Red channel).



Top, after channel mixer +50% R(G), bottom original.

If we go further and instead adjust the Red channels Green contribution, R(G), up to 100%:

First (R, G): 127, 0 āŸ¹ ( 127 + (0 Ɨ 1.00) ), 0 āŸ¹ 127, 0

Second: 127, 64 āŸ¹ ( 127 + (64 Ɨ 1.00) ), 64 āŸ¹ 191, 64

Third: 127, 127 āŸ¹ ( 127 + (127 Ɨ 1.00) ), 127 āŸ¹ 254, 127

Fourth: 0, 127 āŸ¹ ( 0 + (127 Ɨ 1.00) ), 127 āŸ¹ 127, 127

Which is what we see when doing the operation in GIMP:



Again, in all cases, notice that the Green value doesnā€™t change - we are only modifying the values of the Red channel.

Hopefully this makes sense?

8 Likes

Any slider in the Red channel can only affect the R value of your output pixel. Likewise, any slider in the Green channel can only affect the G value of the output pixel, and any slider in the Blue channel can only affect the B value of the output pixel.

Your input values are R50 G200 B10

Normally
the Red channel sliders are R100 G0 B0 this means 100% of 50 + 0% of 200 + 0% of 10. Output R=50
the Green channel sliders are R0 G100 B0 this means 0% of 50 + 100% of 200 + 0% of 10. Output G=200
the Blue channel sliders are R0 G0 B100 this means 0% of 50 + 0% of 200 + 100% of 10. Output B=10
so your output pixel = R50 G200 B10 = input values = unchanged

Lets change the red channel sliders only, remember this can only affect the R value of the output pixel.
Red channels sliders are now R0 G0 B100 this means 0% of 50 + 0% of 200 + 100% of 10. Output R=10
Green channel sliders are R0 G100 B0 this means 0% of 50 + 100% of 200 + 0% of 10. Output G=200
Blue channel sliders are R0 G0 B100 this means 0% of 50 + 0% of 200 + 100% of 10. Output B=10
so your output pixel = R10 G200 B10

Lets change the R channel some more.
Red channels sliders are now R0 G50 B100 this means 0% of 50 + 50% of 200 + 100% of 10. Output R=110
Green channel sliders are R0 G100 B0 this means 0% of 50 + 100% of 200 + 0% of 10. Output G=200
Blue channel sliders are R0 G0 B100 this means 0% of 50 + 0% of 200 + 100% of 10. Output B=10
so your output pixel = R110 G200 B10

Why would adjusting the Blue slider of the Red channel make blues purple?

Input R0 G0 B255 = pure blue

Red channel sliders R100 G0 B100 which means 100% of 0 + 0% of 0 + 100% of 255. Output R=255
Green channel sliders R0 G100 B0 which means 0% of 0 + 100% of 0 + 0% of 255. Output G=0
Blue channel sliders R0 G0 B100 which means 0% of 0 + 0% of 0 + 100% of 255. Output B=255
Output pixel = R255 G0 B255 = pure magenta

HTH

James

Edit: And Pat beat me to it, with pictures and everything :slight_smile: and this was my first real post too.

3 Likes

Hi James:

This is the most clear answer for the topic I am searching for. Especially

Your input values are R50 G200 B10

But again, back to one of my previous question in the same thread

There are many bundled processing profiles in RawTherapee, I checked some of them the way they manipulate color is to play with all the colors in all channels. For example the ā€œfaded golden 1ā€ will set:

  • red channel: r=60, g=0, b=20
  • green channel: r=0, g=60, b=20
  • blue channel: r=-20, g=20, b=40

Based on your formula, I should get

  • Red: 0.6050 + 0200 + 0.20*10 = 32
  • Green: 050 + 0.60200 + 0.20*10 = 122
  • Blue: -0.2050 + 0.20200 + 0.40*10 = 34

So if I set the slides to:

  • Red: R64, G0, B0
  • Green: R0, G61, B0
  • Blue: R0, G17, B0

It should produce same color?

@patdavid and @james, thanks for the great answers to my questions. Itā€™s starting to make a lot more sense to me now. Iā€™ve been reading various tutorials and articles about the channel mixer and this is the first explanation that Iā€™ve found that clearly explains what is happening.

Thanks again!

1 Like
  1. Why are you scaling your slider results? If you wanted the same result as ā€œfaded golden 1ā€ you can set the sliders to R32, G122, B34.
  2. This is the most important thing: this will make the example pixel value like ā€œfaded golden 1ā€ only for this one pixel (R50 G200 B10).

Pretend the very next pixel has a value of R100 G150 B10. Applying your ā€œfaded golden 1ā€ channel mixer values to it yields:

Red: 0.60100 + 0150 + 0.2010 = 62
Green: 0
100 + 0.60150 + 0.2010 = 92
Blue: -0.20100 + 0.20150 + 0.40*10 = 14

Which is not the same thing as setting the sliders directly to R32 G122 B34ā€¦

You will not be able to replicate the color across your entire image to match the ā€œfaded golden 1ā€ preset by only modifying the associated color slider with the channel (reds on red, greens on green, blues on blue).

Hi Hardywang,

I have used a simple mathematical model to demonstrate the concept.

For Rawtherapee it appears the maths is different**. There may be some non-linear scaling or normalization taking place, I donā€™t know, but please donā€™t let this confuse you, the concept described in mine and Patā€™s previous posts is still valid. They correctly demonstrate the behaviour of the sliders for the channels, it is just that the actual output values are slightly different.

So yes, with my simplistic model and a single input colour of R50 G200 B10, your slider values would produce the same output colour as ā€œfaded golden 1ā€, however for other input colours they would not produce matching output colours.

** I generated an 8bit tiff with paint.net filled with the input values R50 G200 B10. I then loaded this tif into Rawtherapee. Unmodified, Rawtherapeeā€™s RGB percentages are near enough correct. (I donā€™t know why RT uses % for RGB values). Applying the slider values of ā€œFaded Golden 1ā€, saving as an 8bit tiff and loading into paint.net shows unexpected output values of R42 G161 B64.

James

1 Like

The RGB values you see in the Navigator panel depend on the working colorspace. If you set it to sRGB the numbers will look as expected. The default space is ProPhoto though and using it the numbers are different.

RT uses for RGB values because makes sense when working in 32-bit floating point precision. 0-255 only makes sense for 8-bit integer precision.

1 Like

@hardywang First of all thanks for starting this topic! RGB Channels is one of my favourite tools in RT (mostly because it enables me to do some Jose Villa shooting Fujifilm 400H film magic to images by making greens bluer and by making skin tones goldener by taking blue out of red)

The image is not mine btw :stuck_out_tongue: itā€™s from one of Jose Villaā€™s Workshops as per link above.

Anywayā€¦

I find this thread useful, because it helps me wrap my mind around what RGB Channels actually does. Most articles online seemed helpful but not altogether fully enlightening, so I mostly play it by ear and make things work to look okay without knowing 100% for sure what Iā€™m doing (shh donā€™t tell my clients).

The way I see it: (Please forgive my ignorance good people, where ignorance may be, and yes, critique and corrections are welcome)

RGB Channels is a tool that lets you define how much of each initial colour is placed in each channel. As an example, the RED channel would be as such:

Red Channel: (what I called initial colour -or all the red thatā€™s available)
Red: 100% ā€“ (here I distribute 100% of it)
Green: 0% ā€“ (here I distribute 0% of it)
Blue: 0% ā€“ (here I distribute 0% of it)

This would mean, since we talk about the red channel, we discuss how much red we put in each channel. So according to the above, we put all of the red channel (all the red colour there is to be worked with) into the final red output, while none of the red is added to the final blue output or green.

It took me a while to figure this out, so thatā€™s why I am over-stressing it. There are two reds; one is the altogether redness that is in the beginning, and then there is the final red amount for pixels. This sounds confusing even to me, so let me use a different example; My turning the greens bluer for filmy effect. Hereā€™s what I do:

Red Channel:
R: 100
G: 0
B: 0

Green Channel:
R: 0
G: 100
B: 0

Blue Channel:
R: 0
G: +40
B: 100

So the way I think of it when I do this is the following; I go to the channel that I wanna do stuff with, in this case it being blue; and then I do stuff with it, in this case add some into green, in this case adding +40 in the green section of Blue Channel.

Considering the previous comment by @Morgan_Hardwood about how making changes to colour channels, I guess I would have to cancel out the channel imbalance by also making the B: 60 (because 100-40=60).

This seemed a bit counter intuitive to me at first: I used to think; "If I wanna add blue to the green tones, well Iā€™ll go to the Green Channel and make it had more blue in it, such as

Green Channel:
R: 0
G: 100
B: +40

but this turned out would add green channel to blue output.

So if I got this somewhat right, the rule of thumb is this:
When dealing with RGB Colour Channels in RawTherapee; when you look at one of them, say Red Channel, you think that this is the colour you are about to work with; and when you edit the R, G, B values within it, you think of those as where you add said channel to.

P.S.:
Iā€™d still love to have sliders that allow you to modify the hue of basic Red, Green, and Blue to other hues, Photoshop/Lightroom style :stuck_out_tongue: But thatā€™s another topicā€¦

9 Likes

Hello,
Iā€™m not sure Iā€™m posting in the right topic but I need help with the channel mixer in RawTherapee. When I change the values, absolutely nothing happens to my picture. I canā€™t understand why.
I hope someone here will be able to help me.
Thanks.

Good evening, @alexis & welcome to the forum!

This may be a silly suggestion, but have you turned the little on/off indicator on? You know, the little ring immediately to the left of the text Channel Mixer:

on

Have fun!
Claes in Lund, Sweden

2 Likes

Hi Claes.
It was as simple as thatā€¦ :stuck_out_tongue: I had no idea you had to click on this tiny circle to activate the mixer. I just started working on RAW format.
Thank you for your help !

1 Like

To be on the safe side: this on/off thing can be found in (almost) every module!

I just have to say that Iā€™m very happy that this this thread got necromanced. I could never figure out how the channel mixer in RT worked.

Now I understand what itā€™s doing, thanks to Patā€™s explanation. But I couldnā€™t figure out the practical application, until I got to @stefan.chirilaā€™s post about making greens look more blue, and it was funny, because last night I was trying to do exactly that, make green plant foliage more blue.

I was messing around with a photo, and only know about the LAB HH adjustment, and the HSV equalizer. I just tried the ā€œchannel mixerā€ technique, and still prefer my results with HSV in this particular picture, but itā€™s a good tool to know about.

3 Likes

Indeed. Thanks for the quick answer. :wink:

thanks for tagging me! I love the RGB channels too; though I dislike the fact that you have to be careful when adding, that you have to also subtract an equal amount ā€¦or the balance is shifted. I wish we had a checkbox that did that for you. It is relevant to keep in mind that results will be different from HSV or HSL because those only work on the greens, while channel mixer will blueify all the green there is in the image, even in pixels that have 20% green 70% red and 10% blue.

Hiā€™ @MStraeten
Thank you for your answer. It makes good sense.

I used the color zones module to get close to the blue color I wanted and used the channel mixer wth a mask to do the last fine tuning.

I have tried to read the thread Please help me to understand "Channel Mixer" - #4 by patdavid several times and noted the following:

ā€¦ā€¦ā€¦ā€¦but adjusting the blue slider in the red channel from 0 to 2 makes changes the G-value from 87 to 78? And the B-value changes as well. See screen shots below. This is not according to the theory?


When using darktable you must habe in mind that there are colorspace transformations in the colorout module. If you didnā€™t change the operating colorspace it is usually rec2020. So if you add something to one channel that results in a value not within rgb colorspace then the values can change when the larger colorspace is forced into a narrower (IMO colorout doesnā€™t just clip channels)

1 Like

Could I kindly ask for some help with an issue over here :slight_smile:

Hi @stefan.chirila, with my limited knowledge of the module, I donā€™t think this is entirely unexpected. Youā€™re putting in negative values, so the module subtracts those. If there was very little green to begin with, and you subtract -20.8 (%?) coming from a strong red channel, you can ultimately end up with negative pixel values.

Something like that?