Question about parametric masks

In many modules, the parametric mask gives 2 options to select by luminosity : the g channel and the Jz channel. I understand that they work in different colour spaces and JzCzhz can work in high dynamic ranges… I think…
Screenshot 2021-09-11 at 16.42.35

But what is the practical difference between the two when I want to select a luminance range?

You can read about it here: darktable 3.6 user manual - parametric masks

I scanned this and I didn’t see a clear explanation of the difference between selecting gray and Jz or L for luminosity but you could try the same parametric mask settings change channel and see what the results would be…

EDIT…not the result I expected …I got a completely different mask…I clearly don’t understand the difference… see the attached file
Jz vs Gray for Luma Mask.pdf (286.6 KB)

The manual is not clear on this.

Basically, g is some linear combination of the R,G,B channels, the exact combination depending on which working color space you are using.

The J_z is a luminance value that is not linear, but rather is perceptual and designed to cope with wide dynamic ranges (the maths is not too difficult, so if you want to look up J_{z}a_{z}b_{z} colorspace you’ll be able to see exactly how the RGB values are mapped).

We should probably include some blurb about what each does, but we should not explain the specific color spaces themselves.


With g being linear, middle grey will be at 18.45, whereas with Jz being perceptual, middle grey will be around 50. Someone else might be able to confirm - I can’t right now - but I vaguely recall testing some while ago and finding it at 59.

@Matt_Maguire @paperdigits Thanks for your comments…it still amazed me the dramatically different mask that you would get by setting the sliders at the same relative positions in each channel…they are completely different…at least on the image of some clouds I shot today…In fact it was like they were the inverse of each other??



Going simpler on the mask setting just dragging the top right slider all the way to the left …so 0 0 0 100…the masks are I guess somewhat predictable but again very different…

It’s not that surprising – the parameteric mask is set to select out only a specific band of luminosities, and because the linear g mapping and perceptual J_z mapping map the pixels to different values, then the set of pizels that are finally selected will be different.

I’ve raised a PR on the manual to try to add some clarity without going into all the maths:


Thanks …might benefit from an example screen shot like I added to the edit of my last post…showing the difference you would get from a 0,0,0,100 mask… using the two different channels

Todd, read my post again, its not surprising at all. 18 in G = 59ish in Jz. So if you set exactly the same values in each, the mask will be much different. To test, in G slide both blacks to 18. Screenshot. Then reset, and in Jz, slide both blacks to 59. Screenshot. They should be very similar.

Note: g above should be lower case but my phone isn’t playing ball.

For sure I did revisit it…checking also the L channel…it was good to know because its also true for the L channel and I had thought it was 50 = 50 in LAB so that was good to check. So 18 for mids in L and g channels and while in theory .5 for the perceptual Jz…your testing at .59 is likely good…

It has really never been a problem as I rarely try to select a precise range like that. I either use the auto picker or move the sliders to highlight visually the area that I am trying to target so I had never really paid any attention to the nuance of this …

Thanks, when I looked at the manual, I didn’t realise that there was an answer to the question. Maybe just a quick explanation with the middle gray point would be nice.