Wednesday, May 21, 2014

Converting Negatives using Darktable

Yes, it's been a while.  Again.

Over the past year I've been digitising my negatives using the method I outlined in earlier posts, and found a method of converting them in batches that gives better results and more control over the process.  Part of what drove me to look at alternatives was the discovery that different rolls of film weren't being converted consistently using my original method; some of them came out yellower or bluer than others.  I guess this is something to do with the age of the negative, brand of film, or how it was developed - or a combination of all of these.  My new workflow allows easier fine-tuning of the results and processing of batches of images in one go which is the best of both worlds - it means you need only tweak the settings for one image in a set of negatives from the same film, then apply these settings to all the others.

The software I'm using is called Darktable.  It's open source (free) but only runs on Linux.   If you're not comfortable installing Linux directly onto your machine then you can - as I have done - use Virtualbox or similar virtualisation software to create a virtual machine that you can install Linux onto (I use the Ubuntu flavour but there are loads to choose from). The Darktable website has a guide to installation on Linux (although your favourite version of Linux may already have Darktable available for installation, it's likely to be an old version so it's best to go to the website to get the latest); and with Virtualbox it's easy to share folders between the host (Windows) machine and the guest (Linux) systems.  Darktable won't run as fast in a virtual environment because it will have less memory to play with, and won't be able to exploit the processing power of your graphics card (assuming you have one capable of supporting OpenCL and with 1GB or more of video RAM), but it works.

Darktable will run, grudgingly, on 32 bit computers with 2GB of RAM but 64 bit and more memory makes it a lot faster and more stable.  

I'll walk through the process of converting negatives using a couple of sample pictures.  Firstly, start Darktable, then on the top left under "import", click the "folder" button.  Navigate to the folder containing your images and press "open".  Your images will appear in the "lighttable" view which is a collection of the images you've imported.


Double-click on an image to open it for editing in "darkroom" view.  The left-hand side contains information about the image and the edits that have already been applied to it (more on this later); the right hand side allows you to access the various different editing tools.  The one we're most interested in is "tone curve".



The "tone curve" module maps input colours to output ones.  The curve (initially it's a straight line) describes how the mapping is made from the point on the x-axis of the graph to the equivalent point on the y-axis.  A straight line from bottom left to top right maps every value to its identical equivalent (ie doesn't change the image).  A straight line from top left to bottom right will effectively invert the image - high values (light colours) will get mapped to low values (dark) and vice versa.

By default the tone curve only works on the brightness (Luminosity) of the image.  However underneath the graph there's an option called "Scale Chroma" which you should switch to manual; this will then allow you to switch to the tabs above the graph marked a and b, and make changes to them.  Rather than working on brightness, the "a" graph works on the magenta/green characteristic of the image and the "b" graph on the blue/yellow.  So changing the line from bottom-left/top-right to top-left/bottom right on all three graphs will effectively invert the brightness and the colours, as you can see below.



However, there's further fine-tuning required.  From here, go back to the lighttable by clicking on "lighttable" at the top right of the screen.  The image in the lighttable should change to reflect the inversion.

Darktable applies, by default, a set of enhancements to every RAW image.  These are "base curve" and "sharpen", and are meant to make your pictures appear in Darktable more like they would look straight from the camera in JPG format.  However "base curve" is another application of the tone curve; since we're trying to invert the image this is an interference we can do without.  Personally I prefer to leave sharpening for later as well.  So we need to get rid of these enhancements - unfortunately Darktable doesn't make it intuitive.  The way I've found that works is to select the edited image in lighttable, then press the "copy" button on the right (under the "history stack" menu).  Then un-tick "base curve" and "sharpen" and press OK. 


 Now click on another image in the lighttable, and under the "history stack" menu again change the option next to "paste all" to "overwrite".  Then click "paste all".  This will apply just your tone curve to the image, and remove the base curve and sharpening effects.  You can now click "copy all" to take the tone curve effect, then choose "invert selection" from the "select" menu and finally click "paste all" again to apply the change to all the other images in the lighttable.  All your images should now have the inversion tone curve applied to  them, and nothing else.

Now it's time to fine-tune.  Double-click on any image to open it in darkroom mode, and start adjusting the curves on the L, a and b graphs.  Your image will lack contrast and you'll see from the histogram on the L graph that the pixels are all around medium brightness.  To increase the contrast , adjust the curve so that it is steeper.  Ensure that the curve starts and ends outside the histogram otherwise you'll make the dark areas of the image too dark and/or the bright too bright.  Drag the curve downwards to make the overall image darker, upwards to make it brighter.  A steeper curve will enhance contrast, a shallower one will reduce it.


Steepening the curve on the "a" graph will increase colour saturation for magenta / green colours.  Moving the midpoint of the curve upwards will make the image more magenta, moving it lower will make it greener.  You can also drag the top half of the curve to adjust the magenta parts of the image (make them more or less saturated) whilst leaving green alone, and vice-versa.  The "b" graph operates similarly for blue / yellow.  Because I've used blue and green flash gels when photographing negatives to neutralise the orange colour cast I usually find that only small adjustments are needed upwards and downwards, but the curve needs to be quite steep to bring back the necessary colour saturation.


Clicking on the pipette at the top right hand corner of the tool will bring up a small square on the image which you can click and move around; numbers will appear on the graph showing how the input value of the pixel at the centre of the square maps to the output.  For the "a" and "b" graphs, the value 0 means colour-neutral (ie white or grey).  By using this on parts of the images known to be grey you can see how the curve should be adjusted to get a perfect result.

Beware of over-saturating the colours in the image (making the "a" and "b" curves too steep); I've also found that parts of a picture meant to be dark brown (e.g. wood furniture) can be problematic to get right - if the "a" graph isn't carefully adjusted you can end up with greenish patches; the solution to this is to raise the top of the curve (make things more magenta) until the green just disappears, but not so much that any faces in the images start to become blotchy.

There are other options in Darktable for sharpening and removing image noise, I've found that "Denoise (profiled)" and the "equalizer" tool using the "Denoise (subtle)" preset work well for this.  Basically from this point forward you should make whatever adjustments you want to perfect the image.  You can then go back to Lighttable mode and use the copy all / invert selection / paste all method to apply the same changes to all your other images, before exporting.

1 comment:

Unknown said...

Thanks for this post. It helped clarify some of my struggles with what the a & b we're doing during the invert process.