Mask Manager

Mask Manager

This week's tutorial features a discussion of Darktable's Mask Manager. Adding the Mask Manager to your Darktable toolkit will help you organize drawn masks, and adds functionality and efficiency to your edits.
We missed out on "Edit my RAW" last week, so we've doubled up this week. The first image involves some stubborn fringing along a cliff edge at sunset, and a variety of approaches to tackling it.
In the second image, everything comes together smoothly to lead into our Mask Manager discussion.
Thank you to both Rainer and Pedro for your winning contributions. I look forward to mailing your prizes out.
You can find scripts I use in the show at My Scripts. The compositing I quickly gloss through in this episode is fully explored in the Compositing with Darktable episode.

RedRock Canyon RAW
RedRock Canyon XMP 1
RedRock Canyon XMP 2

Norfolk Island RAW
Norfolk Island XMP1
Norfolk Island XMP2
Norfolk Island XMP3

Complete Show Text

Download complete text here

This week's first edit is a RAW contribution from Rainer.

We've got a sunset and sandstone cliffs.

It looks like there's a fringe around the edge everywhere.

See that? Right there.

Maybe it will come out with the Chromatic Aberrations Control.

We could turn that on and save it, and see if it's better.

Let's see now.

Well, the Chromatic Aberration Control got rid of a lot of it.


A little bit here on the side.

And right here.

Oh, and here too.

Well, it certainly got rid of a lot of it, though.

This edge looks so soft.

This looks a little rough right here.

Let's try the Defringe Module.

Oh, that got rid of a lot of it too.

I'll turn down our Threshold.

I think that got rid of most of it.

Right there.

Oh, now we've got this halo that the Defringe Module is creating.

Look at that, right there.

Okay, take our Edge Detection Radius and turn it down so we get rid of this halo.

And, does it still correct in these other places? Mostly, but not fully.

We've got green on one side and red on the other.

Is that from the Defringing Module? No, I think that's the way it came out.

That's frustrating.

Let's see if we use a different DeMosaic-ing operator.

I had set DeMosaic-ing to PPG, so we'll change it to AMAZE.

I've still got this green edge.

Color Smoothing? I'll turn it all the way up to five times.

We've still got this edge.

VNG? That helps some, but with the Chromatic Aberration Control on, it's giving me...

Okay, does that help? Argh! I can't tell if the Chromatic Aberration gets rid of the fringing or not.

I have to...

Here, I'll delete this and I'll save this again.

And we'll look at it with the Chromatic Aberration on.

I'll turn it on.

And over-write.

And export.

Let's see what happens.

No, we've still got it.

I am not going to get rid of that easily.

We'll use a brute force approach, then.

We can take the sky and move it into the rocks a little bit with an L Mask.

Let's see what that looks like.

Let's see: I've got my Chromatic Aberration on, I've got my DeMosaic-ing set to VNG; I'll just take my Color Smoothing off and go with AMAZE.

I don't need my Defringing Module, so that's off: good.

Okay, we'll export this to the Watermark Directory as a JPG.

If I make it small, I can probably keep my quality to 100% Let's see: Freehand, and make it as small as this edge here -- the area in question.

Let's see, I set up a pre-set for this.

It saves it to the Watermark Module as a JPG.

Since I'm making it small, I'll try keeping my quality all the way up at 100%.



And I've got a quickie script I wrote that just looks for the most recent file in the Watermark Directory, uses Inkscape to convert it to an SVG, and then reads me back the size.

This script is on my website, under Resources.

Oh, good: it's only 6.2MB.

You can get all the way up to 8MB and be okay.

Okay, it's done now.

We go to the Watermark Module and look for tmp.svg There it is.

Okay, you can see that it applied it on top of the other one.

We want to vertically align that.

We'll use a Parametric Mask, and we don't want to apply it to the sky, just to the rocks.

L Channel, and get rid of the sky.

Oh, too much.

That looks good.

That's with it off, and that's with it on.

Set our Y Offset.

There we go.

Without it, and with it.

It cleaned up that edge really tight, but it gave us this little ghosting here, so we'll change our Blend Mode to Darken Only.

There we go.

That really tightens up this edge.

Let's see what it looks like over here.

That's before it.

We've got all this maroon fringing and this green fringing here, and a soft edge here.

And, after, it's all tightened up.

We've got a little bit of fringing but a lot less than we had before.

Well, that looks good, but I don't need it everywhere, so I'll combine that Parametric Mask with a Drawn Mask and just paint where I want it.

I'll give it a little bit of a Blend Radius.

There we go.

0.6 pixels; not even a full pixel.

Alright, let's look at our before and after.

Here's our before, and there's our after.

A little bit of a brute force approach there, but it gives a nice edge and we don't have that halo at all now.

What's next? Noise Reduction.

Let's look at Noise Reduction.

There's not much noise in the sky.

What was this shot at? 200 ISO: no wonder there's not much noise.

There's just a tiny bit.

This Profile Denoise is great with the Nonlocal Means for when the noise is really light, and you can turn the strength really far down.

I usually turn it way down, then just turn it up barely as much as I need.

It looks like I only need right around 0.4 on the strength.

Let's look at what our sky should look like.

Let's see: Sky chart.

Probably somewhere between Deep and Dark.

It looks like our A should be somewhere between zero and whatever our L value is; our B should go somewhere between -60 and -20.

We'll take some samples.

We're probably going to have to adjust that so that the A is a little more positive because there's all this maroon in the sky.

Okay, and here, and how about one more: this one.

It looks like our B needs to be a lot more negative because we're nowhere near that.

And the A is not too bad: that looks about right.

Okay, so we want a lot lower B.

Now, how about the sunset areas? Let's add some of those.

One, and another, and here's another one.

Okay, what are we looking for there? Sun: there's not much difference between Copper and Deep Red.

This one looks like, on this side, the B Channel is higher than the A, and on this side the A Channel and the B Channel are closer to the same.

It looks like the A and the B should be pretty close to each other, and so should the L.

What do we have? We have the A and the B being dramatically different, with the B a lot lower.

So, we want to lower the B in the sky, but we want to raise the B in the sunlit areas.

We can do that with Color Correction.

Here we are.

There are two dots.

You can only see one dot when you start, because the white dot is on top of the black dot.

The white dot controls Color Correction for the lighter parts of the image; the black the black dot for darker parts of the image.

So, I'll take the black dot and move it towards the blue, and the white dot towards the yellow.

Now I'll look at my numbers here.

See, that made this warmer and made this cooler.

Before, and after.

It's hard to tell because it's affecting the sandstone too, so let's exclude the sandstone.

Use a Parametric Mask and just exclude it.

Turn on our Mask Indicator.

There we go.

A little Blend Radius there.

Before, and after.

Okay, the blue is a bit much, so I'll bring the blue back up a little bit.

What does that do? We got a little warmer than we'd expect on the A, but that was what we wanted because the sky is a little maroon, but we've got some nice solid blues here.

And, over here, our A and our B are still needing more B.

I'll bring this to the left a little.

Okay, that brings us a little more in balance.

And, I'll take the whole thing and only apply it around 2/3 strength.

There we go.

Okay, that's before we started, and that's after.

We've got a little more color separation and our blues are a little bluer.

Our highlights are a little more warm.

Now I'd like to do a little Tone Mapping on these sandstone cliffs to bring out some of the contours, but if I do that now, I'll change some of my inputs on my Parametric Masks, so I'll Save before I do that.

So, I'll save this as a TIFF in the directory I'm working in now.

Alright: Tone Mapping.

Oh, that does a great job on these cliffs.

I don't want it to happen in the sky, so I'll use a Parametric Mask again.

Give it a little bit of a Blend Radius.

It looks like almost 1.5 px Blend Radius.

I'll change my Opacity.

There we go: 69%.

I could probably go less than that.

There we go: 50%.

That's before, and that's after.


Now I'd like to add some contour shading, but first I want to increase the contrast in the sandstone.

I'll use the Tone Curve for that.

Change this to Area and select an area.

There we go.

I'll remove these so they're not confusing.

And bring this up a little bit.

Oh, nice; now I've got something to work with.


And we still look good on our exposure.

I'll increase the tonal detail of certain sizes by using the Lowpass Filter.

I'll turn the Saturation all the way down and bring up my Brightness a little and bring my Contrast down just a little.

Take my Radius and change it to the size that gives me the shapes I want to see.

This gives me nice, rounded and macroscopic features.

It also brings out some of the shading and contours in the clouds.

That's around 15px or so.

I'll apply that with the Softlight Blend Mode.

There we go.

And turn down the Opacity a little.

That looks good right around there.

I'm right around 50%.


I'm going to do that again, this time with a little smaller Radius.

I'll bring my Contrast down a little, my Brightness up a little, get rid of my Saturation, and use a little smaller Radius so I get some finer details.

Like that: now I can see the horizontal stratification lines in the cliffs.

That's around 7px.

Once again, I'll apply that with the Softlight Blend Mode.

And adjust my Opacity to the right level.

Okay, that looks good.

Now we've got a nice, sharp edge here.

I like that.

I'll bring out more detail, this time using the Highpass Filter, once again with the Softlight Blend Mode to get the detail I want.

I like these shadows in here; I want to emphasize them.

Get my Contrast.

There we go; that looks good.

Okay, I'll apply that with the Softlight Blend Mode also, but it's going to come out too strong.

So, I'll apply an L Mask to this.

Instead of Uniform, I'll change it to Parametric, and on my L Channel I'll change my Input so it's Linear.

Okay, and I want to get more effect down here, so I'll bring this down a little bit.

Like that.

I'll take the Opacity down because it's too much, and I don't want to get this halo effect up here.

I'm still getting that halo effect.

Let's see what we've got.


I think I'm going to apply this just to the darker parts of the image.

Combine this with a Drawn Mask.

That gives us more detail in the sandstone, but leaves the sky.

This edge along here...

...I think I don't have to worry about it.

We're not getting that halo, because of the L Mask.

So, I was able to bring this all the way up to 48% What next? I want more color.

I want more color in the whole image.

I want deeper color in the whole image.

I'll use the Subtract Method to do that.

I'll do another Lowpass Filter.

I'll set my Radius low and slowly bring it up until I get some larger features of color.

That looks good.

Then I'll change my Blend Mode to Subtract and bring my Opacity up very slowly.

It deepens the colors, but does it in spatially large areas so I get more separation.

Before and after.

It's a little dark up here.

I want more contrast in this part of the image.

There we go.

Bring this up a little and bring this in a little so I get more contrast.

Before and after.

I like it; that's good.

We've got a second RAW contribution this week.

This one's from Pedro.

It is from Norfolk Island.

I looked that up; it's somewhere near Australia, I think.

Is there more than one Norfolk Island? I don't know.

Anyway, it was shot with a Nikon.

Beautiful shot.


I want to be able to see detail down here, and bring out some of the colors up here.

First thing, we'll set the Base Curve.

This is a Nikon.

There are a couple of Nikons here.

Let's try that one.

Then, this one is an Alternate.

Let's see what that one looks like.

I like that first one better.

We need to do a little Crop and Rotate.

First, I'll de-rotate by using my right mouse button, and clicking and dragging on the horizon.

But, after doing that, I've got an awful lot of sky up here.

Let me do a little Gamma adjustment so we can see what we're looking at.

There we go.

We've got a lot of blue sky up here, and I don't get a sense of a vista because it looks a little boxed-in.

It almost looks like I didn't get straight on my horizon.

Let's adjust just one degree.

That looks better.

Let's try a 2:1 ratio.

There we go.

Now it looks like I'm looking at a spanning vista.

Like, right there.

Also, this looks like I'm looking down on these trees.

Maybe, if it looks like I'm looking into the distance...

I'll catch the bottom of this tree, and then it continues on.

Maybe a little bit higher.

This white building is a little jarring to me, so I'll just adjust it to miss the building...

Oh, I do like these trees, though...

Okay, like that.

White building stays.

2:1 I like that.

I like that a lot.

Okay, what do we have for noise here? Shot at 100 ISO, we probably don't have any noise, or very little.

There's a little bit of color noise.

Oh, there's some noise in here too.


Let's try our Profiled Denoise, which works really well for these low ISO, low noise situations.

I'll just take my strength down really low and bring it up slowly.

Right about there.

Oh, I feel like I'm losing detail.

Let's try denoising it with the Equalizer instead.

Go to the Luma Channel here, and I'll just raise these first two until the noise goes away.

Then I'll bring this and this one over until I just get rid of the noise, and no more.

Right there.

Okay, what does that look like? Ah, I feel like we're keeping more of the detail.

Let's do that with the Equalizer.

We can do a little Chroma Denoising while we're at it.

We're a lot less critical with the Chroma Denoising.

No, that did not turn out well.

I'll have to make that a lot smaller.


Get rid of this Tone Curve.

That was temporary.

I'll use Global Tone Mapping to bring out these shadows.

I'll use Tone Mapping AND Global Tone Mapping.

If I just use the Global Tone Mapping, that doesn't quite do what I'm looking for.

Let's see.

If I use this Tone Mapping: Ah, there we go! See, that really brings it out.

That's what I wanted.

Contrast Compression is way too high.

Let's bring that down.

Maybe there.

And the Spatial Extent.

Let's bring that down.

Right around there.

What are we at? 8%.

Then, I don't want to apply it everywhere; I want to use an L Mask and apply it to the darker parts of the image.

I'll use a Parametric Mask based on the L Channel and set it to only the darker parts of the image.

Like that.


I'll apply it with a Screen Blend Mode instead of Normal.

That kind of adds it to itself.

And I can take my Opacity and turn it down a little.

Where it comes in here: because of that L Mask, I'm going to need to set a Blend Radius to give me a smoother edge.

Okay, I'm all the way up to 2.5px That looks more natural.

Now let's do some Global Tone Mapping in addition to that.

Ah, there we go.


Now, our Blend.

Let's take this Opacity and turn it down.

What if I just base that on the L Channel linearly? Oh, I like that.

I'm going to give it a little bit of a Blur too.

So, I just went from 100 gets 0 percent of the effect, so that 0 gets all of the effect.

That gives me a linear gradation of this Tone Map.

Then I'll turn down my Opacity because I don't want it full strength.

There we go.

Let's look at our history here.

This is when we started.

And this is where we're at now.

We've got a lot more detail down here and we didn't lose our contrast up here.

We can get a little more equalization between the brighter areas and the darker areas by using a Lowpass Filter with the Overlay Blend Mode.

Take our Saturation down to zero and bring our Blend Radius up.

There, now we just have large light and large dark areas.

That's what I want.

It's aroung 72px.

I'll apply that with an Overlay Blend Mode.

Then I'll turn my Contrast all the way down to zero and slowly bring it down a little past zero.

There we go, we're all the way down at -26.

That's before, and that's after.

That knocks down the highlights a little and brings up our shadows a little.

How are we looking here? We'll have to set our Black Point.

It's off.

But I don't want to do that now; we'll mess up all our Parametric Masks.

How are our colors? Take a sample of our greens.

Here's some green.

Here's some green.

It looks like our greens are a little heavy on the green and light on the yellow.

I'll warm up my White Balance a little.

And take my Tint There we go.

This looks like a better ratio.

Okay, Demosaic-ing.

Then, Chromatic Aberrations.

Then we'll save it and start over again.

Let's see: PPG, AMAZE.

You know, I really like that AMAZE.

It does a wonderful job.

We've got beautiful definition on this island.

I'm happy about that.

VNG makes it a little softer.

I'll stick with AMAZE.

Turn on my Chromatic Aberration Control.

Then save this as a TIFF.

Now, open it.

I'd like to get more oomph out of this back part here in the distance.

We can apply a Drawn Mask going in two different directions.

We've got one coming this way.

And one coming this way.

Turn on our Mask Indicator, and we see that it's the Union of the two.

And we want the Intersection.

So, if we turn on our Mask Manager here, we can right-click on this one.

This top one should be Union.

Then the second one needs to be Intersection.

There we go.

It's in between the two.

I'll turn off my Indicator.

I want to do a Subtract on this.

And base that on the L Channel.

So, that would be Drawn plus Parametric.

It mostly affects the brighter parts of the image.

Slowly bring up my Opacity.

That should deepen the colors and darken it as you go to the horizon.

That was before, and this is after.

I'd like to see these foreground areas show that the sunlight, despite its distance, is affecting them.

I want to set it up so that, in the foreground, the areas that are lighter get a little more yellow.

I can do that with the Tone Curve.

I'll do a Drawn Mask so that we're just doing the stuff in the foreground.

Reverse the Polarity.

There's what it looks like.

Then we'll combine a Parametric Mask with that so that we get more of the effect on the brighter parts.

Lets see.

Like that.

There we go.

Okay, I don't want it to affect this water here.

So, I've got to bring that down a little.

That's what I want.

Now I'll give more yellow punch to that area.

I want to get some shaping and shading to these larger elements like these trees and the islands and whatnot.

I'll use the Softlight Blend Mode on a Lowpass Filter.

So, I'll take my Saturation down to zero and use my standard technique of dropping my Contrast down a little and my Brightness up a little.

Get my Radius so I'm seeing these trees and these islands pop from the background.

I'm losing detail, and that was right around 25px.

Apply that with the Softlight Blend Mode and then attenuate it with the Opacity.

That's none of it; that's all of it, so maybe right around there is what I want.

Okay, I'm up around 30%.

I'm pretty happy with that.

I like what it did with the clouds too.

Before and after.

It gives them a little more separation from the background.

Now, this top part: I want to see more color up here.

And I don't want to just increase the color everywhere.

I'll just try to increase the color in certain areas.

I'll use the Equalizer.

There's our Chroma Channel.

We'll do a Drawn Mask for these parts up here.

If we increase that...

That looks good to me.

Before, and after.

I'll get rid of the Mask Indicator.

Before, and after.


What else? I want to pick up some detail.

I've lost it with these Lowpass Filters that I've applied, so I'll use my Highpass Filter to get some of this detail back.

Let's see.

That looks good.

Bring my Contrast just as high as I need it to be to pick out the detail I want.

I'll apply this with the Overlay Blend Mode and bring the Opacity down.

I'm happy with how that turned out.

I want to talk about the Mask Manager.

The Mask Manager only works with Drawn Masks; it doesn't work with Parametric Masks.

But you can combine Drawn Masks in ways that you cannot from the individual modules.

Let's try an example.

We'll do a Gradient.

Here, I'll turn on the Mask Indicator so we can see what's going on.

And then, maybe a circle...

Now they're combined.

It's the Union of both, though.

That's the mathematical operation here.

You've got to click on this little arrow.

When you do that, you can right-click and it offers you options.

Now, these are in order.

The order matters.

So, the first one needs to be Union.

Then, the second one can be Intersection.

You'll find then that you've got a gradient fill from one end to another on this circle, because it's the Intersection of the two.

So, if I take my Gradient Fill here and make it smaller, it changes how this works inside of here, so that now the Gradient Fill is inside of the circle.

There are other operations too.

You can change it to Exclusion, which is like exclusive-or.

I think that mostly the Intersection, with the first one being Union, is what you're looking for.

If you start with Intersection, you're not going to get anything.

You always have to make that first one Union.

Another cool thing about the Mask Manager: you can re-name your Masks.

You can take a group and name it something.

You don't right-click on it; you double-click on it to name it.

Then you can call it whatever, like "my group." And you can name different shapes, too.

So, you can call this one "sky gradient," for instance.

And you can call this one "sun" or "island," or whatever you want.

Anyway, I love the Mask Manager.

It lets you make groups.

You don't just have to have groups that are associated with a Tone Curve; you can make groups and have them be separate.

Then, when you go to another curve, or whatever Module you're using, and you select Drawn Mask, the name of your group will show up.

See, it says "my group" right there.

Also, here is "island" and "sky gradient." The Mask Manager will save you time and keep your Masks organized.

Last thing about the Mask Manager that I really like.

If you've got Masks that are right next to each other, it's easy to select them in the Mask Manager because you can just click on the name; you don't have to try and get it on the screen, and then that's the one that's highlighted.

Alright, everybody, thank you for watching this week.

My wife and I have been working on building a studio.

We tried to buy a 24 inch printer so we could do some canvas wraps, but ran into difficulty having it shipped to Hawaii.

After much frustration, we looked on Craig's List in desperation, and found a beautiful 60 inch, 12-color printer just 100 miles from us.

So, we rented a truck and fetched it.

We converted part of our greenhouse into a studio to house it, and just finished the project a day ago.

Here's a little walkthrough video I made for you.

"It's a beautiful morning in paradise.

Hi, Little (our dog).

Let's see what's going on with Tanglewood Studio.

(noise of walking on stones) 'Hi, Sweetheart' 'Hi' We've got some art on the walls.

We've got our desks set up.

We've got our printer.

This is our new studio.

It used to be our greenhouse.

Now it's our sanctuary in the jungle." Oh, that was fun.

It's wonderful to have our own studio.

Here's my website.

It's called I have a second site called Please send comments and suggestions, and engage in the discussions.

I love to hear from everybody.

It makes us all better photographers to learn from each other.

I look forward to next week's edition.

We're getting close to the holidays.

Maybe we'll come up with something in a holiday theme.

Please send me your RAW contributions.

That's my favorite part of the show.

See you all next week.