Local Lab build


@jdc The changes look great, and it seems quite stable now. There are some aspects of its use that I don’t understand yet, I will have a closer look, but may have some questions. Great work.

(dngimage) #582




Is running fine here.

(Hansgeorg) #583

Hi, I just tried out the latest locallab build on a red poppy blossom which is a bit unsharp. Really great what you all did there, quite easy to use and makes RawTherapee even better!
I want to express my gratitude to all developers of RawTherapee :clap:


Hello, the locallab function works very well now. However, I really don’t understand how the mask in ‘Exposure’ and ‘Color and Light’ function.
Here I have lightened the tree using the locallab exposure function

As I understand it, I would expect, for example with the L(L) function, if I tick ‘use mask’ the, line is a the top. I would expect it to be white, and for it to act on all values of brightness. If I pull curve down to the left, I would expect it to act less on dark values (ie brighten dark values less). If I pull the curve down on the right, I would expect it to act less on bright values. However, the mask, just seems to darken parts of the image, not change how how the exposure function affects the image (see below) . I think I have totally misunderstood how this is meant to work, so would appreciate some sort of explanation, or point me towards where I can find out how to use it. Many thanks.

(Desmis) #585


I know there is currently no entry in Wikipedia. I will try to explain the principle.
Admittedly, it’s a mask but it works differently from the ones we usually find.

The created mask is subtractive and acts on two aspects :

  1. that of common sense, the mask is removed from the original image and interacts globally with reference-based shape detection parameters.
  2. more finely, the modifications made affect the shape detection parameters of the image and act on the deltaE. In this sense, the user can accentuate or reduce “locallab” to select this or that part of the image to act.

These two points combined bring a very important difference compared to the “traditional” software (Photoshop, Gimp…)

This difference is fundamental (see the explanations on Wikipedias in French, which I am in the process of updating).
In one case, you selected an area (with the mouse), and the algorithm is the same as entire image,
In the second the selection is secondary (it is the same approach as Dx0 or CatureNX), and the algorithm try to find what the user want…
The algorithm compare, hue, luminance, chrominance (and now structure) of the little area under the little selection circle, and hue, luminance, chrominance and structure of each pixel.
Of course, it’s more complex than that.

To return to the mask, of course we can use it as if it were with Photoshop, but unless we want special effects I do not recommend it at all.

Just above the combo box, you can see 3 informations, for exemple
Ref(0…1) Chroma=0.049 Luma=0.250 Hue=0.486
These 3 values are the reference value (of the little circle area), those used for shape detection. They are displayed in the interval 0.1, to allow the user to act on the curves without touching (or so voluntarily) references.

In the example, the curve L=f(L) must be at top of the diagram for Luma=0.250 (the quarter of the abscissa), you can low around this value, very moderately depending on what you are looking for. For example x=0 y=0.9
If you want to improve shape detection, low values are recommanded (for example 0.9 in ordinate, for x=0, and for x=1), if you want special effects values higher values can be used (for example 0.6 in ordinate) but always without touching the reference value (x=0.250 y=1)


@jdc Thanks so much for providing such a detailed explanation. I will have another look at it now that I have a better idea of how it works…


@jdc I’m not sure if it is working as it should or I am doing something wrong - see the effect of exposure below



Exposure and colour and light have very little effect, had tried adjusting ‘scope’

Locallab is turned on.

Version 5.5-536-gd1b4c84ef Windows 10
Raw file and pp3 attached

GWR railway 42.RW2 (14.8 MB)
GWR railway 42.RW2.pp3 (15.0 KB)


Further playing around, seems like the exposure and colour tabs have a much larger effect on more colourful / brighter objects.
Same settings for +180 in exposure for the each example below. It has virtually no effect on the dark green engine but a larger effect on the bright orange fence.

Version 524, seemed like the settings caused larger adjustments, but this didn’t have the structure detection…

Not sure if this is being helpful!

(Desmis) #589


Thanks for testiing !

Some explanations

  1. the algorithm “exposure in locallab” is different from “Exposure in main menu”, the second in RGB mode, the first in Lab mode
  2. the algo himself is quite different
  3. but for locallab the concept with “ref” and delta leeds to very very big differences

The old algo was buggy…

Now, the behaviour is “normal” when we look at how works the algorithm.
If we look to the values in the area (with GWR_railways42.RW2) you selected
a) the ref luma value is very very small
b) values around are very very small, if I speak in Lab values (range 0…100), they are about L=0.1 a=0.0 b=-0.3 to L=0.1 a=-0.1 b=0.0
If we push the slider “exposure” above 200, and acts on Scope, we can leed values as L=0.3 a=0.1 b=-0.5 and L=0.1 a=-0.1 b=-0.
If we push the slider to 700, and acts on Tone curve, and also use Lightness, we can reach values about L=0.5 to 0.8 (but with artifacts)
This increase is substantially consistent with what I planned for the algorithm, with some anomalies due to gamut (without Locallab, values above are out of gamut in sRGB, Adobe…)

I will have a look to the algo, to see in that case, if it is possible to improve, without guarantee of success


(dngimage) #590

@gaaned92 and @jdc,




Is running fine here.


@jdc. Thanks Jacques. Very helpful as always.

(Desmis) #592

I think I have solve the problem, with very low light.

Moreover, I made a review of the locallab algorithm, now more than 3 years old.
The principle is the same, but I change order and parameters. Now, the algo

  • works for low lights,
  • there are hugely less artifacts
  • the shape detection works better
  • the code is simplified.

I will commit a change in the day for the moment limited to “Exposure”, but it should not pose too many problems to extend it to other modules (Color and Light, Blur, etc.)



Great look forward to trying this

(Desmis) #594

I just commit a change with a new algorithm for exposure
This algo is not really new, it uses the same parameters, but in order diffrent, and in other way.

It is used also for “vibrance” and “Soft light”

Be careful, the slider is much more sensitive.
You can use also, highligt compensation (with moderation)
I add a slider “Blur shape detection”, because now the system is very sensitive, and in some cases, where details are with big differences of deltaE, perhaps the user does not want to do that.
This functionnality was present but not adjustable.

I think , I will soon convert also, Color and Light.
This should simplify the menu of “Color and Light”, fewer choices (which were due to artifacts), and simplification of the general menu


(dngimage) #595

@gaaned92 and @jdc,




Is running fine here.

(Desmis) #596

I push a change

  1. big clean code for exposure
  2. change calculation for mask - there was a huge bug… but I think (I don’t know why, but sometimes - not always - mask does not work correctly ?)

Thank you for testing.


(JegMeg) #597

Exposure seems to work better with the newest build:



(dngimage) #598

@gaaned92 and @jdc,




Is running fine here.


Thanks look forward to trying it out…

(Desmis) #600

I commit a change to prevent (I hope) memory hang (or crash!) when using mask (curves…)

There is always in some cases a a weird malfunction.