Compositing with Darktable

Extend Darktable’s functionality by compositing with the watermark module

In this video tutorial I look at compositing with the watermark module. The procedure is simple but powerful. Here's how it works:

Darktable's watermark module allows you to overlay an svg file on the current canvas. I find 8mb to be the current upper limit on the file size of the svg in order for Darktable to import it properly. A bitmap image can be converted into an svg file by using inkscape like this:

inkscape -f filename.jpg -l filename.svg

It's that simple. The svg file needs to be located in


Blending can be accomplished with the usual suite of blending operators (drawn and parametric).

* note: in this video I use the Raw black/white point module... but that is probably not a good idea. The exposure module is the much preferred solution!

The RAW file used in this video is available here. Thank you fatdunky for the contribution 🙂

Complete Show Text

Download complete text here

Aloha everybody, and welcome to another edition of Weekly Edit.

I have such an exciting edit for you this week.

I am going to be showing you a new technique that I'm working on to do compositing right inside Darktable.

It's using the Watermark Module.

Because it's the Watermark Module, you get to use Blending Operators with the compositing.

The idea is to take a bitmap, convert it to an SVG file, and load it in the .config/darktable/watermarks directory, and then overlay that on an image and use a Blending Operator to properly insert it, whether it's with an L-Mask or with Drawn Mask or a combination of different masks.

So, here is a RAW file, and it's a contribution from Fat Dunky.

Thank you, Fat Dunky! Oh boy, you gave me a challenge! This is the Milky Way, and there are clouds here.

The stars are a lot brighter than the Milky Way, so I'm going to want to knock down the stars and accentuate the MIlky Way.

There's a pond here, and the stars are reflected the pond.

It's beautiful.

There are trees here.

They're really dark.

My idea is that this end of the pond, closest to the foreground, should be shimmery and glassy.

I want to bring out some of the detail in these trees.

I know they're dark, but I don't want to just see silhouettes.

I'd like for these clouds to pop from the background.

I'd like for the stars to have less brightness in relation to the Milky Way, and I want to see more color in the Milky Way.

It looks like there is some air glow down here from a city, maybe.

I want to knock that down too: right down here and over here.

Okay, let's get started.

I'll attack this photo with two different edits.

In one, I'll concentrate on the dark areas: these trees and the lower part of the image.

Then, I'll work on the sky and the Milky Way.

Then, I'll combine them using the Watermark Module.

So, here we go.

First, I'll increase the brightness just so I can see what's going on in this image.

Well, it looks like we're tilted a little, so I'll take care of that first.

I want to be sure both images have the same geometry so they go together properly afterward.

Now, we don't want to just increase the brightness.

Look at how much noise we end up with in these trees.

So, we'll get rid of our Exposure; put our White Point back to its default setting.

Let's use the Base Curve for a Canon.

Okay, can Tone-Mapping help us? Maybe some.

Like that? Use a Parametric Mask based on the L Channel to try and isolate these darker areas.

Like that.


Use a Screen, and bring down the Opacity significantly.

What does that look like? Okay, I'll take that way down, and only use a tiny bit of it.

I don't want to use Global Tone Mapping because we already don't have much color, and that will make whatever color we have go away.

Let's clean up the image a little.

Let's see: Chromatic Aberrations.

If we correct for Chromatic Aberrations, does it improve or decrease the quality of the image? It looks to me like it gets rid of a lot of the noise in here and some of the halos.

How about our Demosaic-ing strategy? I started with PPG because it's responsive, but how do we do if we change to a different method? Oh, Amaze looks a little better.

It got rid of some of those hotter pixels.

VNG looks pretty soft.

Is that bad here? I don't know; how about with some color smoothing? Ah, I like that.

Okay, let's use the VNG.

This is such high noise.

Usually the VNG is a little soft, but I think we're going to be soft anyway.

I'd rather have the noise reduction.

Alright; I want to increase the brightness in this area.

If I just increase the brightness, I'll increase a lot of noise, so I'll use a Gaussian Blur to increase the brightness so that it increases it without the noise.

Before I get started on that, I feel like it's time to address the Denoising on this, so that as we're working we get a better idea of where we actually stand.

I'll just brighten the image so that we can see which Denoising strategy gives us the best results.

I'll use Snapshots to help assess.

First, I'll just try RAW Denoise.

This starts off with a 0.01 setting.

That's usually a little heavy and makes you lose a lot of detail.

It looks like it makes our magenta really over the top.

I don't know why.



Denoise Profile: the old standby with Nonlocal Means.

Okay, we're getting these kind of large grouped pixels, so it's got this mottled look.

If we change our Patch Size, it doesn't seem to be helping much.

Okay, what if we go to a higher ISO? No, that doesn't help either.

Okay, how about this Bilateral Filter? Well, that's certainly too large.

We are ending up with the same crazy pattern we had with the Nonlocal Means.

How about THIS Nonlocal Means? I know that this says Nonlocal Means, and so does this, but I get different results.

Well, that looks pretty good.

From that, to that.

Alright, I'll go with the Denoise Nonlocal Means.

Now, I only want that up here in the trees; down here I want that shimmery look.

I'll get that by using Wavelets.

I can take this back down to 1600.

I'll use the Drawn Mask.

I want it to get shinier as it comes toward the foreground.

There we go.

Alright, I think that's what I have in mind.

That all looks pretty good.

There's a lot of magenta over here.

Bring that down.

Okay, now I'll start working with the Gaussian Blurs.

I'll take my Radius all the way down, create a second instance, take that Radius all the way down.

This one I'll use for Lab color and this one I'll use for Lab Lightness.

So, I'll use this Brightness and the Contrast to increase the brightness in this area, but I don't want to introduce a lot of noise.

So, I'll increase my Radius when I get my Contrast and Brightness set where I want, just high enough to get rid of the noise but to keep the details coming through.

Well, we didn't increase the noise.

We'll have to come up with some way to get a little more contrast, but I'll work on that a little later.

Now I want to increase the color the same way.

I'll use the Saturation Slider.

Crank it all the way up.


Then, I'll increase the Radius a little so it gets applied in a nice even way.


I don't want to increase it too much because we don't want color fringing around these edges.

I want to add more contrast between these brighter and these darker areas.

I'll use a Tone Curve to do that.

With a Parametric Mask.

I'll look at the brightness of these different parts.

Okay, they go from here to here.

I want to use the Subtract Method more on the darker areas to bring the Black Point down and accentuate the contrast.

So, I'll take this slider and move it all the way over, and take this slider and move it to here.

That should give me a gradient inside this area.

I could use a little more of a gradient there.

I'll bring this down a little.

There we go.


Now, I'll apply a Mask Blur so we don't get this stippled effect.

Okay, turn off my Mask Indicator.

Now I'll turn my Opacity all the way down, change my Blend Method to Subtract, and then slowly turn up my Opacity.

Oops, too fast.

Oh, that's too much.

There we go.

Boy, oh boy, that's powerful.

From there, to there.

I think that's what I was looking for.

Okay, what else do we need? I think we've brought out a lot in this.

Okay, I'll work on the sky now.

Okay, so here's how it goes.

I take this image.

I convert it to a bitmap.

I convert that bitmap to an SVG.

That SVG cannot exceed eight megabits; otherwise Darktable won't import it properly.

It doesn't matter what the bit depth or the resolution is; the only factor that really matters is that 8 mb.

I found I get the best quality if I export as a JPG and bring my quality down just a little, around 93, and that almost always brings me in under 8 mb on a 24 megapixel image.

So, in this image, I've been working in SRGB; I'm going to stay there.

This is really important.

When you export, it goes into .config/darktable/watermarks I'll call it tmp because it's just a temporary file: tmp.jpg Okay, it's exporting.

In the meantime, I'll open a terminal window.

I'm going to .config/darktable/watermarks/ I'll type "inkscape" You'll need Inkscape.

It's easy to get.

It's in the Package Manager, and it's free.

You can download it for any platform; it works on everything "-f" means "file name" We called it "tmp.jpg" Then "-l" is our "output name" and we call it "tmp.svg" The important part is that extension: .svg And that's it: there's nothing more than that.

It happens really fast.

Now I'll take this image and clear all that stuff we did except for the Crop and Rotate.

Now I'll work on the sky.

What do I want to do with the sky? First, I'll black out this bottom because we're going to use the bottom from the other image.

Let's get rid of that.

Okay, there we go.

Now: the sky.

If I just increase the Brightness, that doesn't do much for the Milky Way.

We want to increase the brightness more selectively.

Let's look at our Demosaic-ing Operators and whatnot, and get our noise out of the way first When we were assessing the different algorithms before, we were looking in the trees where it was really dark.

This noise profile is different because I haven't even increased the brightness yet, and we can already see what's going on.

So, we're starting from scratch.

That's the PPG; here's the Amaze.

I don't see an improvement there.

Here's the VNG; I definitely don't see an improvement there.

It makes such large splotches of color that they get lost amongst the stars.

Let's see if we took our PPG and did a little Color Smoothing, how does that look? Oh, that's pretty good.

And three times? Two times? Boy, I like that PPG with two times.

Let's try the Amaze with some Color Smoothing.

I think I'm a fan of the PPG with two times.


Okay, what else? Chromatic Aberrations.

Does it help or hurt us to correct it? Well, it looks like it helps in here.


Hot Pixels.

We should just be able to use the same settings we had before.

Bring our Threshold down, and we've got our 6000 pixels just like last time.

Okay: Denoising.

There's the Profile Denoising.

For the night sky, you'll get these blotchy areas of green and red with Nonlocal Means.

See that? It's almost like a matrix-- with the Nonlocal Means.

I usually end up using the Wavelets, but the Wavelets end up leaving these little tiny -- see these little tiny green and red color noise? So I go up to Equalizer on the Luma Channel -- and the bottom part is for noise and the top part is for contrast.

Take these two bottom ones and bring them up, and to get rid of that.

See, there it goes.

I can do the same thing on the Chroma Channel.


Okay, how about Defringing? Will that help us with that purple? Yes; it got rid of it.


This part here is too bright, and over here too.

It's like there are city lights or something.

Then, this part from here up to here is a little too dark.

I'll change those now, before I move on.

Wow, that needed a lot.

It looks a little flat; I'll increase the blue a little.

Then, this top part looks too dark.

I'm trying to match this brightness with this brightness.

Then I'll take this area and try to bring that down a little.


We'll use the Equalizer to bring out the Milky Way and the clouds.

But, if I just use the Equalizer without cutting out the trees, I'll get halos: watch.

See all these halos? Okay, so I'll use a Drawn Mask.

There we go.

With the Chroma Channel too.

Now, see, the stars are awful bright still.

We can use this same Equalizer to reduce the stars by taking the Contrast and bringing it down.

There we go.

That knocks down the stars and increases the Milky Way.

Alright, same thing with the Chroma Channel.

Bring it down here and here, and bring it up here.

Maybe even a little more Chroma.

That looks good.

How about some edges too.

We can bring the Edges up because we've increased the contrast in the Luma Channel.

That enables us to reduce the spatial distance in that contrast, basically affecting it like a Local Contrast Adjustment with this Edge Setting.

Alright, that's looking pretty good.

I want it to be more colorful, and a little brighter in here.

I think a Gamma adjustment and a Subtraction Operator.

But I think I'll do that after assembly.

Okay, we'll set our Black Point and do everything else later on.

I'm just going to bring up the Brightness.

Now we go over to the Watermark Operator Module.

There's our file: tmp.svg Don't pick the JPG; that doesn't do anything.

You've got to use this SVG.

And that's our other one that we did before.

We don't want it in the sky, but we do want it in the darker parts, so we'll use the Blend Modes and figure out the right combination of settings so we get it where we want it.

The first choice would be the L Mask.

That's a good start, right? There.

Okay, maybe a little Mask Blurring.

And we could take this and feather it.

And we don't have to do 100%, so we'll take our Opacity and bring it down just a little.

You know, I do want it 100% down here, but I don't want it 100% up here.

I think instead of changing my Opacity, I'll combine the Parametric Mask with a Drawn Mask, use a Fountain Fill, and set up my Fountain Fill so that about 75% of it is here and 100% down here.

I'll make it really big and then bring this way up here.

There we go.

Now this is getting most of it and this is getting all of it.

Okay, now I'll export this and enhance the color, set the Black Point if it's required, and I think that's done.

So, I'll export it as a TIF.


Zero and zero; I'm still working in SRGB.

There we are.

Now, increase the Gamma a little right in here, and let's add some color.

I'll use a Parametric Mask based on the L Channel and the Subtract Blend Mode.

I think a little Sharpening up here would not hurt.

I like all of this except that some of the colors down here are too saturated.

I'll deal with that separately.

Color Zones looks like a good place to start.

We didn't catch the outside of that? Oh, it's way over here.

That looks better; okay.

Alright, Fat Dunky; thanks so much for the RAW image.

Wow, I'd like to go there.

I love those sticks sticking up through the pond and the way the stars reflect, with the cliffs on the side...

It would have been nice to have had a couple of images.

Maybe the cliffs and the trees on a windless night could have been maybe a 2-minute exposure because you wouldn't have to track with the stars.

That would have given a lot less noise and a little more pixel-to-pixel consistency.

It sure is a beautiful area.

Thank you for your contribution.

Hey, everybody, send me your RAW files.

Then I'll pick one each week and it'll be part of the presentation.

I'm just out there learning new stuff and sharing it with you guys.

This is a lot of fun for me.

You can go to my site. There's some extra functionality there.

You can build playlists; you can watch the videos there.

Somebody said that it's hard to watch the videos there because the images were flickering between the new and the old versions of the RAW files.

So, we changed that.

We love all your comments, and we especially love the questions and the suggestions.

Alright, everybody; have a great week.

I'll see you next week.


Visit for RAW files and show notes Check out our Patreon page early every week for a preview of the next week's topic