How to create camera noise profiles for darktable


How to create camera noise profiles for darktable

An easy way to create correct profiling pictures

[Article updated on: 2019-11-26]

What is noise?

Noise in digital images is similar to film grain in analogue photography. In digital cameras, noise is either created by the amplification of digital signals or heat produced by the sensor. It appears as random, colored speckles on an otherwise smooth surface and can significantly degrade image quality.

Noise is always present, and if it gets too pronounced, it detracts from the image and needs to be mitigated. Removing noise can decrease image quality or sharpness. There are different algorithms to reduce noise, but the best option is if having profiles for a camera to understand the noise patterns a camera model produces.

Noise reduction is an image restoration process. You want to remove the digital artifacts from the image in such a way that the original image is discernible. These artifacts can be just some kind of grain (luminance noise) or colorful, disturbing dots (chroma noise). It can either add to a picture or detract from it. If the noise is disturbing, we want to remove it. The following pictures show a picture with noise and a denoised version:

![Noisy cup|760x507](upload://eXhl1kOG5wKO6mmdKbsqC8rmbfE.jpeg "Image with noise") ![Denoised cup|760x507](upload://7znirK0vFIzMSjhMLUWt9ooCKmS.jpeg "Denoised image")

To get the best noise reduction, we need to generate noise profiles for each ISO value for a camera.

Creating the pictures for noise profiling

For every ISO value your camera has, you have to take a picture. The pictures need to be exposed a particular way to gather the information correctly. The photos need to be out of focus with a widespread histogram like in the following image:


We need overexposed and underexposed areas, but mostly particularly the grey areas in between. These areas contain the information we are looking for.

Let’s go through the noise profile generation step by step. For easier creation of the required pictures, we will create a stencil which will make it easier to capture the photos.

Building a profiling testbed


  • A dark room (wait till night time)
  • Monitor
  • Printer
  • Sheets of black thick paper (DIN A3, >= 200g/m²)
  • White paper
  • Scissors
  • Sellotape (Tesafilm)

First you need to get some thicker black paper or cardboard. No light should shine through it! Then you need to print out a gradient on white paper. Light should shine through the white paper!

Print this black to white gradient (PDF)

I got black thick paper (DIN A3, >= 200g/m²) and used two sheets. You need to be able to cover your monitor with the black paper. Put the printed gradient in the middle and draw around it. From three sides (bottom, left, top) make the window smaller by 1 cm, see Figure 1. On the right we need to have a gap.

![Stencil Step 1|760x507](upload://bchY4sZgdmDeVL284CjIjMnctWv.jpeg)
Figure 1: Drawn window reduced by 1 cm on the bottom, left and top.

Next is to cut out the window and type the gradient onto the black paper like in Figure 2. It is important that there is a gap between the white and the black paper on the white side of the gradient. We need light for an overexposed area.

![Stencil Step 2|760x507](upload://whGhhOHezLNowsWuvNG8c3zLmJZ.jpeg)
Figure 2: The gradient taped into the window of the black paper.

Once you have done that go to your monitor and make it all white. You can an all white image for that. Then tape the sheets to your monitor like in Figure 3.

![Stencil Step 3|760x507](upload://1pwslFlafzwHQhjzKqvQNBYv8i.jpeg)
Figure 3: The sheets of black paper taped to the monitor.

Taking the pictures

It is time to get your camera. You need to shoot in RAW. It is best to turn off any noise reduction especially long exposure noise reduction. Mount the camera on a tripod and use a lens between 35 mm to 85 mm (full frame). I used a 85 mm f/1.4 lens.

Make sure the gradient fills most of the frame. Set your camera to manual focus and focus on infinity. Select the manual mode of your camera and choose the fastest aperture and ISO100. Depending on the lens you’re using you might want to close the aperture. For me f/1.4 was too blurry and I closed it till f/4.0. You don’t want to see any edges or any structure on the paper but be too blurry. You want to still see the gradient but we want nice transitions between different lightning zone black -> grey -> white like in Figure 4.

Now you need to set the shutter speed. Make the picture really dark and then make the shutter speed longer till the gap which gives us the white from the monitor is overexposed, pure white see Figure 4. The black around the white paper should be underexposed (pure black).

![Example noise picture|760x505](upload://pGPuW6ncGhXPiA3g1LuPv5AiPyf.jpeg "Example shot for noise")
Figure 3: Example shot for noise.

Now you need to take a picture for each ISO value of your camera. When you increase the ISO value you need to decrease the shutter speed!

Creating the noise profiles



/usr/lib/darktable/tools/darktable-gen-noiseprofile --help

If this gives you the help of the tool, continue with STEP 2 otherwise go to STEP 1a. Packages for openSUSE, Fedora, Ubuntu and Debian packaging the noise tools can be found here.


Your darktable installation doesn’t offer the noise tools so you need to compile it yourself. Before you start make sure that you have the following dependencies installed on your system:

  • git
  • gcc
  • make
  • gnuplot
  • convert (ImageMagick)
  • darktable-cli

Get the darktable source code using git:

git clone

Now change to the source and build the tools for creating noise profiles using:

mkdir build
cd build
cd tools/noise
sudo make install


Download the pictures from your camera and change to the directory on the command line:

cd /path/to/noise_pictures

and run the following command:

/usr/lib/darktable/tools/darktable-gen-noiseprofile -d $(pwd)

or if you had to download and build the source, run:

/opt/darktable_source/lib/tools/darktable-gen-noiseprofile -d $(pwd)

This will automatically do everything for you. Note that this can take quite some time to finish. I think it took 15 to 20 minutes on my machine. If a picture is not exposed correctly, the tool will tell you the image name and you have to recapture the picture with that ISO. Remove the non-working picture.

The tool will tell you, once completed, how to test and verify the noise profiles you created.

Once the tool finished, you end up with a tarball you can send to darktable for inclusion. You can open a bug here

The interesting files are the presets.json file (darktable input) and, for the developers, the noise_result.pdf file. You can find an example PDF here. It is a collection of diagrams showing the histogram for each picture and the results of the calculations.

A detailed explanation of the diagrams and the math behind it can be found in the original noise profile tutorial by Johannes Hanika.

Feedback is very much welcome in the comments below!

This is a companion discussion topic for the original entry at

Great write up Andreas! I hope it encourages others to contribute to darktable. Have you noticed a big improvement with the custom profile?

If anyone is using the open source AMD drivers and can’t get OpenCL working in darktable, Andreas has an easy to follow guide here: Using AMD Open Source and the amdgpu-pro OpenCL driver for image processing – Andreas Schneider

1 Like

Excellent article, and just what I need! I have a Samsung NX1 camera that does not have an official noice profile in darktable yet, and have tried to generate noise profiles based on the original article on the darktable site, but did not quite manage to get good enough source images to be included in the distribution.

But after seeing this, I will definitely try again :slight_smile:

1 Like

Thank you Riley. The denoise (profiled) module gives you normally the quickest way to get good result for denoising. There is a nice triple which works on lightness, color and average which gives amazing results without loosing much detail.

The first stencil I created failed, I just had two big holes. Then I created the one in the article and directly succeeded. Start with needle holes and improve from there, make sure you have some real black in the pictures (the edges which are only black in mine). If you’re successful please share you’re stencil and tell us which lens you used.

I just took an out-of-focus photo of a bright spotlight shining on a wall in a dark room. This ensured I had blown highlights, clipped shadows and a range of brightness in between. Used this method to profile a couple of cameras and the generated profiles were accepted by the project. Seemed to work well.

When I ran it I used a differently-named script but, without the “-d $(pwd)” option I believe it will attempt to take the photos for you. Requires you to have tethered your camera via USB, pre-focussed the shot and have your camera be supported by gphoto2.

Hi Chris,

this also sounds like an interesting idea. What light did you use exactly and can you post an example photo of a shot you took?

I can’t upload at the moment but if you look at (comment 21) I think they’re included in the tar.gz I uploaded. As you can see I was considering writing such a guide myself to encourage more users to contribute, based on the original blog post profiling sensor and photon noise | darktable, which is a bit complicated and slightly off-putting unless you can get past the science!

I just used a normal lamp (LED bulb I think).

According to the original blog post, the only requirements are “take one shot per iso. it has to be out-of-focus and have a widespread histogram, i.e. be over- and underexposed at the same time”

One of my profiling images. As you can see I didn’t put much thought into it apart from making sure it fit the criteria (out of focus, under- and over-exposed)

I expected something different, but I have a new idea: Get a normal white piece of paper (a bit of light can shine trough) with a black frame (non-transparent). Illuminate the white paper from behind. Make sure to be far away from a wall and turn off the lights. This way the background should be black, we have a white spot in the middle which should transition to gray. If this is not overexposed yet, we can make a small hole in the middle of the paper for the overexposure.

Maybe someone could try this out …

Worth a try though I’m not sure you’ll get a smooth transition all the way from white to black (there may be parts of the histogram that are empty, though defocusing will help). The simpler you can make the process the more likely people will give it a go.

Another thing to mention… Once I had my generated profiles accepted into the project there was a period during which I was waiting for them to be included in the next release of DT. In the meantime I found that the generated profiles could be manually incorporated into my existing DT installation by manually modifying the installed noiseprofiles.json file to include the contents of the generated presets.json. On my system (ArchLinux) I found the DT installed noise profiles in /usr/share/darktable/noiseprofiles.json.

Make sure you take a backup first!

It was my intention to have some brainstorming and people contributing to the process. The more stencil we can test and get results from it, the easier the process will become. We can always update the article.

Oh, this method so sweet, can’t wait to try it :slight_smile:

I managed to make an image using a combination of outside/inside light that worked quite well. The results however astounded me and now provide an excellent correction (automatically) through the full ISO range of my camera. The only time that I need to adjust my denoise setting is when I push process a part of the image and therefor theoretically modify the image’s local ISO. Profiling took very little time and the developers now include my camera profile in the distribution. If your camera is not currently listed … do it!


Could you explain what advantages the stencil has over the ‘out of focus under- and over-exposed’ approach (like the sample image I posted). Does it give a better quality denoise? I’ve had very good results from the simpler approach but perhaps I’m missing something.

A lot of people tried and had over and underexposed areas, but the results were unusable. You find a lot of open tickets for camera support where it didn’t work. The stencil makes it easier to get good results. We need a good transition from white to black. We are interested in the grey between them. Your image has a lot of color, if you look at mine, there is white, black and grey (no color). The out of focus areas produce the grey values we’re interested in …

1 Like

Based on my unscientific research (I’ve looked through a number of the most recent accepted and rejected profiles in darktable issues) most of the tickets that were rejected seem to have one of two comments:

  • Not out of focus enough
  • Not enough values between over- and under-exposed

Many of the accepted images have colour in them - indeed white and grey contain all of the colours. I see a lot of accepted profiles based on images similar to mine - an image of a light on a wall in a dark room ensures a good range of values as the brightness drops off gradually with distance and a bare bulb ensures over-exposure.

My understanding is that the reason for defocussing is two-fold. First (most important) it prevents any finely textured objects from masquerading as noise. Second it will (as you say) give more values between over- and under-exposed.

I see where you’re going with the stencil approach though. It definitely could lead to a consistent reproducable way to produce noise profiles, which can only be a good thing and encourage more people to try it.

I thought it might be useful to post some example images that have been successfully used to produce noise profiles (ones that have been accepted into the darktable project). I’ve also provided the relevant issue reference from for each image.

As you can see there’s quite a lot of variance in the images but all have produced acceptable profiles.









I’ve recently did the noise profile for my Nikon D5600 following the original darktable post.
No comments yet, so I don’t know if they are going to accept it.

One thing I see you did differently is that you didn’t apply the “raw linear” style to your RAW images.

this makes sure we get linear camera raw rgb with no basecurves, no whitebalance, etc in the way. it is essential that you apply this style.

Just wondering why you choose not to apply it.

When I ran my own, AFAIK the script did all that automatically. Following the original post (and taking into account that the script has changed a bit since then) I just set the camera up, tethered it and ran


The script did the rest - took the images, processed them and auto-generated the tar.gz file

1 Like