My KDE week

RAW image processing with digikam

Posted on: August 6, 2011

Digikam 2.0 got released recently and while I am really happy about its active development there is one thing in digikam which I am still struggling with – RAW image processing. Yet since there was progress I would like to share my findings which will hopefully help others having the same trouble.

If your camera supports shooting pictures in RAW format you might want to try that feature. However for those that are not into the details of (RAW) image processing the result is quite disappointing if you use digikam and its defaults. Pictures are too dark and colours dull. If you want to pull beginners into RAW image usage you have to either push them to read some documentation in order to get satisfying results or pull the user by providing defaults that lead to motivating results and support/feed the user’s curiosity which in return will make him search and read further information without any pushing.

RAW picture with default settings and Highlights set to "rebuild"

The beauty of RAW images is that you can do a lot of things and fine-tuning until the image fits your expectations, yet beginners’ expectation is simply to get a picture that looks the same or better than the JPG preview they see in digikam. Thus defaults should provide exactly that as a starting point for further processing.

JPG preview of RAW image

Other RAW image processing apps like darktable do this by e.g. providing base curves for your camera that put some vibrancy and colour into the dark and dull RAW data and hence motivate the user to get deeper into the possibilities of RAW image processing. Digikam currently does not provide that feature.

Using the luminosity curve

However, with a little work one can get there. If you set digikam to open the demosaicing tool for RAW images (settings > RAW decoding > Always open the RAW Import Tool to customise settings) opening a RAW image in the editor will show you the tool in the sidebar. First thing to notice: if you set White balance > Highlights to anything but “solid white” the picture will become even darker. Not sure why this does not happen with e.g. darktable since it does also handle highlights. But I think this is also the reason why in digikam the luminosity curve has to be pushed a lot further than in darktable. I set Highlights to “rebuild” in digikam.

Now you have to move to the post processing tab. There is more than one way to get to a satisfying result and you can even combine them. You can lighten-up the picture with setting gamma to e.g. 1.4 and then play with saturation and the other settings.

Another and my preferred way is to use the luminosity curve. To start with you can try to arrange it in a way that the RAW image looks like the JPG preview. To do so you have to adjust the luminosity curve which maps the input colours to the x-axis and the output colours to the y-axis. Hence moving the curve above the linear level will brighten-up the respective colour area. If you install an app that uses base curves such as darktable you can try to mimic the curve it uses for your camera. Having the picture you are processing digikam’s album view you can quickly change between those two windows by pressing ALT+TAB and compare the pictures without having to save all the time.

RAW picture with Highlights set to "rebuild" and luminosity curve applied

Luminosity curve

Some hints regarding the handling of the curve. Moving the points can become quite tricky if they are close. So if it happens that clicking on a point to move it makes digikam move the one left to it instead, try clicking a bit to the right of the point you actually want to move. In case you want to start all over again click on the tiny icon at the origin of the curve.

You will have to test your curve on different pictures since the colour spectrum is different and your curve should fit all pictures equally well. To save a curve you have to import the picture. Obviously there is not the one curve that is perfect for everybody – not even a curve that is perfect for all one’s pictures. So there should actually be two luminosity curves in the processing. One base curve that fits as default for one’s camera and one does not fiddle with all the time. And then a second luminosity curve which one can fiddle with per picture to make slight adaptations without changing the base curve.

Saving and sharing luminosity curves

Since digikam cannot save several curves and only keeps one, you have to work around that issue. What I do is to simply copy ~/.kde4/share/config/digikamrc to a sub-folder and keep versions of the curve for different cameras. If you have a look at [RAW Import Settings] within that file you will see the curve’s settings which you can copy and paste in order to share/import it. If digikam does one day implement a feature to save/load curves and maybe even suggesting one depending on the camera manufacturer, it will need some working curves to offer – so if you have a working luminosity curve please share it and post it into the bug report that describes the feature. Don’t forget to add your camera model to the post.

The sad news is that all of this does not work with the batch queue manager since there is no possibility to set any post processing values for the automatic handling. This would be another place where it would come in handy if one could save/load curves.

So here are the settings for a Panasonic LX3 (keep in mind to set Highlights to Rebuild otherwise the curve makes the image too bright):

RawCurveChannel0Point0=0,0
RawCurveChannel0Point1=1791,4438
RawCurveChannel0Point10=-1,-1
RawCurveChannel0Point11=43263,61781
RawCurveChannel0Point12=-1,-1
RawCurveChannel0Point13=51455,63829
RawCurveChannel0Point14=-1,-1
RawCurveChannel0Point15=60159,64853
RawCurveChannel0Point16=65535,65535
RawCurveChannel0Point17=-1,-1
RawCurveChannel0Point2=6399,14337
RawCurveChannel0Point3=10495,22870
RawCurveChannel0Point4=15103,31403
RawCurveChannel0Point5=19455,40960
RawCurveChannel0Point6=24575,48128
RawCurveChannel0Point7=28671,52906
RawCurveChannel0Point8=-1,-1
RawCurveChannel0Point9=35839,58368
RawCurveChannel0Type=0
RawCurveChannel1Point0=0,0
RawCurveChannel1Point1=-1,-1
RawCurveChannel1Point10=-1,-1
RawCurveChannel1Point11=-1,-1
RawCurveChannel1Point12=-1,-1
RawCurveChannel1Point13=-1,-1
RawCurveChannel1Point14=-1,-1
RawCurveChannel1Point15=-1,-1
RawCurveChannel1Point16=65535,65535
RawCurveChannel1Point17=-1,-1
RawCurveChannel1Point2=-1,-1
RawCurveChannel1Point3=-1,-1
RawCurveChannel1Point4=-1,-1
RawCurveChannel1Point5=-1,-1
RawCurveChannel1Point6=-1,-1
RawCurveChannel1Point7=-1,-1
RawCurveChannel1Point8=-1,-1
RawCurveChannel1Point9=-1,-1
RawCurveChannel1Type=0
RawCurveChannel2Point0=0,0
RawCurveChannel2Point1=-1,-1
RawCurveChannel2Point10=-1,-1
RawCurveChannel2Point11=-1,-1
RawCurveChannel2Point12=-1,-1
RawCurveChannel2Point13=-1,-1
RawCurveChannel2Point14=-1,-1
RawCurveChannel2Point15=-1,-1
RawCurveChannel2Point16=65535,65535
RawCurveChannel2Point17=-1,-1
RawCurveChannel2Point2=-1,-1
RawCurveChannel2Point3=-1,-1
RawCurveChannel2Point4=-1,-1
RawCurveChannel2Point5=-1,-1
RawCurveChannel2Point6=-1,-1
RawCurveChannel2Point7=-1,-1
RawCurveChannel2Point8=-1,-1
RawCurveChannel2Point9=-1,-1
RawCurveChannel2Type=0
RawCurveChannel3Point0=0,0
RawCurveChannel3Point1=-1,-1
RawCurveChannel3Point10=-1,-1
RawCurveChannel3Point11=-1,-1
RawCurveChannel3Point12=-1,-1
RawCurveChannel3Point13=-1,-1
RawCurveChannel3Point14=-1,-1
RawCurveChannel3Point15=-1,-1
RawCurveChannel3Point16=65535,65535
RawCurveChannel3Point17=-1,-1
RawCurveChannel3Point2=-1,-1
RawCurveChannel3Point3=-1,-1
RawCurveChannel3Point4=-1,-1
RawCurveChannel3Point5=-1,-1
RawCurveChannel3Point6=-1,-1
RawCurveChannel3Point7=-1,-1
RawCurveChannel3Point8=-1,-1
RawCurveChannel3Point9=-1,-1
RawCurveChannel3Type=0
RawCurveChannel4Point0=0,0
RawCurveChannel4Point1=-1,-1
RawCurveChannel4Point10=-1,-1
RawCurveChannel4Point11=-1,-1
RawCurveChannel4Point12=-1,-1
RawCurveChannel4Point13=-1,-1
RawCurveChannel4Point14=-1,-1
RawCurveChannel4Point15=-1,-1
RawCurveChannel4Point16=65535,65535
RawCurveChannel4Point17=-1,-1
RawCurveChannel4Point2=-1,-1
RawCurveChannel4Point3=-1,-1
RawCurveChannel4Point4=-1,-1
RawCurveChannel4Point5=-1,-1
RawCurveChannel4Point6=-1,-1
RawCurveChannel4Point7=-1,-1
RawCurveChannel4Point8=-1,-1
RawCurveChannel4Point9=-1,-1
RawCurveChannel4Type=0

and a Nikon D90. Since I do not have that many pictures off a D90 this curve is not as tested as the one for the LX3.

RawCurveChannel0Point0=0,0
RawCurveChannel0Point1=2303,5462
RawCurveChannel0Point10=-1,-1
RawCurveChannel0Point11=-1,-1
RawCurveChannel0Point12=49663,62805
RawCurveChannel0Point13=-1,-1
RawCurveChannel0Point14=-1,-1
RawCurveChannel0Point15=-1,-1
RawCurveChannel0Point16=65535,65535
RawCurveChannel0Point17=-1,-1
RawCurveChannel0Point2=8703,16384
RawCurveChannel0Point3=-1,-1
RawCurveChannel0Point4=16895,32768
RawCurveChannel0Point5=-1,-1
RawCurveChannel0Point6=-1,-1
RawCurveChannel0Point7=29183,49834
RawCurveChannel0Point8=-1,-1
RawCurveChannel0Point9=-1,-1
RawCurveChannel0Type=0
RawCurveChannel1Point0=0,0
RawCurveChannel1Point1=-1,-1
RawCurveChannel1Point10=-1,-1
RawCurveChannel1Point11=-1,-1
RawCurveChannel1Point12=-1,-1
RawCurveChannel1Point13=-1,-1
RawCurveChannel1Point14=-1,-1
RawCurveChannel1Point15=-1,-1
RawCurveChannel1Point16=65535,65535
RawCurveChannel1Point17=-1,-1
RawCurveChannel1Point2=-1,-1
RawCurveChannel1Point3=-1,-1
RawCurveChannel1Point4=-1,-1
RawCurveChannel1Point5=-1,-1
RawCurveChannel1Point6=-1,-1
RawCurveChannel1Point7=-1,-1
RawCurveChannel1Point8=-1,-1
RawCurveChannel1Point9=-1,-1
RawCurveChannel1Type=0
RawCurveChannel2Point0=0,0
RawCurveChannel2Point1=-1,-1
RawCurveChannel2Point10=-1,-1
RawCurveChannel2Point11=-1,-1
RawCurveChannel2Point12=-1,-1
RawCurveChannel2Point13=-1,-1
RawCurveChannel2Point14=-1,-1
RawCurveChannel2Point15=-1,-1
RawCurveChannel2Point16=65535,65535
RawCurveChannel2Point17=-1,-1
RawCurveChannel2Point2=-1,-1
RawCurveChannel2Point3=-1,-1
RawCurveChannel2Point4=-1,-1
RawCurveChannel2Point5=-1,-1
RawCurveChannel2Point6=-1,-1
RawCurveChannel2Point7=-1,-1
RawCurveChannel2Point8=-1,-1
RawCurveChannel2Point9=-1,-1
RawCurveChannel2Type=0
RawCurveChannel3Point0=0,0
RawCurveChannel3Point1=-1,-1
RawCurveChannel3Point10=-1,-1
RawCurveChannel3Point11=-1,-1
RawCurveChannel3Point12=-1,-1
RawCurveChannel3Point13=-1,-1
RawCurveChannel3Point14=-1,-1
RawCurveChannel3Point15=-1,-1
RawCurveChannel3Point16=65535,65535
RawCurveChannel3Point17=-1,-1
RawCurveChannel3Point2=-1,-1
RawCurveChannel3Point3=-1,-1
RawCurveChannel3Point4=-1,-1
RawCurveChannel3Point5=-1,-1
RawCurveChannel3Point6=-1,-1
RawCurveChannel3Point7=-1,-1
RawCurveChannel3Point8=-1,-1
RawCurveChannel3Point9=-1,-1
RawCurveChannel3Type=0
RawCurveChannel4Point0=0,0
RawCurveChannel4Point1=-1,-1
RawCurveChannel4Point10=-1,-1
RawCurveChannel4Point11=-1,-1
RawCurveChannel4Point12=-1,-1
RawCurveChannel4Point13=-1,-1
RawCurveChannel4Point14=-1,-1
RawCurveChannel4Point15=-1,-1
RawCurveChannel4Point16=65535,65535
RawCurveChannel4Point17=-1,-1
RawCurveChannel4Point2=-1,-1
RawCurveChannel4Point3=-1,-1
RawCurveChannel4Point4=-1,-1
RawCurveChannel4Point5=-1,-1
RawCurveChannel4Point6=-1,-1
RawCurveChannel4Point7=-1,-1
RawCurveChannel4Point8=-1,-1
RawCurveChannel4Point9=-1,-1
RawCurveChannel4Type=0

One thing that I am not yet satisfied with is that the LX3 curve has too much green in it – but unfortunately I am unable to get it less green without either the whole picture getting too dark or yellow- and red-ish colours not being as vibrant as I want them. So if you have any hints on how to achieve that I would appreciate it. Maybe this is because digikam darkens the image when rebuilding highlights which forces the user to use a more extreme luminosity curve in order to compensate the darkness – which in other apps one does not have to do.

UPDATE: I tried with Highlights set to “solid white” and get a lot better results (oddly especially in highlight areas but also regarding details in non-highlight areas) with a curve that does not need to compensate the darkness added by “rebuild”. So for a LX3 you might want to try to set saturation to 1.09 in the post processing tab and paste the following curve into your digikamrc:

RawCurveChannel0Point0=0,0
RawCurveChannel0Point1=3327,4780
RawCurveChannel0Point10=-1,-1
RawCurveChannel0Point11=-1,-1
RawCurveChannel0Point12=49151,57344
RawCurveChannel0Point13=-1,-1
RawCurveChannel0Point14=-1,-1
RawCurveChannel0Point15=-1,-1
RawCurveChannel0Point16=65535,65535
RawCurveChannel0Point17=-1,-1
RawCurveChannel0Point2=-1,-1
RawCurveChannel0Point3=11775,15702
RawCurveChannel0Point4=17407,23552
RawCurveChannel0Point5=-1,-1
RawCurveChannel0Point6=23039,31403
RawCurveChannel0Point7=-1,-1
RawCurveChannel0Point8=33023,44373
RawCurveChannel0Point9=-1,-1
RawCurveChannel0Type=0
RawCurveChannel1Point0=0,0
RawCurveChannel1Point1=-1,-1
RawCurveChannel1Point10=-1,-1
RawCurveChannel1Point11=-1,-1
RawCurveChannel1Point12=-1,-1
RawCurveChannel1Point13=-1,-1
RawCurveChannel1Point14=-1,-1
RawCurveChannel1Point15=-1,-1
RawCurveChannel1Point16=65535,65535
RawCurveChannel1Point17=-1,-1
RawCurveChannel1Point2=-1,-1
RawCurveChannel1Point3=-1,-1
RawCurveChannel1Point4=-1,-1
RawCurveChannel1Point5=-1,-1
RawCurveChannel1Point6=-1,-1
RawCurveChannel1Point7=-1,-1
RawCurveChannel1Point8=-1,-1
RawCurveChannel1Point9=-1,-1
RawCurveChannel1Type=0
RawCurveChannel2Point0=0,0
RawCurveChannel2Point1=-1,-1
RawCurveChannel2Point10=-1,-1
RawCurveChannel2Point11=-1,-1
RawCurveChannel2Point12=-1,-1
RawCurveChannel2Point13=-1,-1
RawCurveChannel2Point14=-1,-1
RawCurveChannel2Point15=-1,-1
RawCurveChannel2Point16=65535,65535
RawCurveChannel2Point17=-1,-1
RawCurveChannel2Point2=-1,-1
RawCurveChannel2Point3=-1,-1
RawCurveChannel2Point4=-1,-1
RawCurveChannel2Point5=-1,-1
RawCurveChannel2Point6=-1,-1
RawCurveChannel2Point7=-1,-1
RawCurveChannel2Point8=-1,-1
RawCurveChannel2Point9=-1,-1
RawCurveChannel2Type=0
RawCurveChannel3Point0=0,0
RawCurveChannel3Point1=-1,-1
RawCurveChannel3Point10=-1,-1
RawCurveChannel3Point11=-1,-1
RawCurveChannel3Point12=-1,-1
RawCurveChannel3Point13=-1,-1
RawCurveChannel3Point14=-1,-1
RawCurveChannel3Point15=-1,-1
RawCurveChannel3Point16=65535,65535
RawCurveChannel3Point17=-1,-1
RawCurveChannel3Point2=-1,-1
RawCurveChannel3Point3=-1,-1
RawCurveChannel3Point4=-1,-1
RawCurveChannel3Point5=-1,-1
RawCurveChannel3Point6=-1,-1
RawCurveChannel3Point7=-1,-1
RawCurveChannel3Point8=-1,-1
RawCurveChannel3Point9=-1,-1
RawCurveChannel3Type=0
RawCurveChannel4Point0=0,0
RawCurveChannel4Point1=-1,-1
RawCurveChannel4Point10=-1,-1
RawCurveChannel4Point11=-1,-1
RawCurveChannel4Point12=-1,-1
RawCurveChannel4Point13=-1,-1
RawCurveChannel4Point14=-1,-1
RawCurveChannel4Point15=-1,-1
RawCurveChannel4Point16=65535,65535
RawCurveChannel4Point17=-1,-1
RawCurveChannel4Point2=-1,-1
RawCurveChannel4Point3=-1,-1
RawCurveChannel4Point4=-1,-1
RawCurveChannel4Point5=-1,-1
RawCurveChannel4Point6=-1,-1
RawCurveChannel4Point7=-1,-1
RawCurveChannel4Point8=-1,-1
RawCurveChannel4Point9=-1,-1
RawCurveChannel4Type=0
Saturation=1.09

RAW picture with Highlights set to "solid white" and the above luminosity curve applied plus saturation set to 1.09

3 Responses to "RAW image processing with digikam"

It is a bit difficult to do proper RAW editing just using the Curves tool. It is doable, but I prefer using a number of tools in a sequence. But let me first say that you can configure digikam to at least auto-expose the image after demosaic’ing. It’s one of the options of the RAW import tool. It’s a good help for beginners, but let me explain why I never use it.

The point to develop RAW files is that you have a much larger dynamic range to work with, more control over white balance and less posterization while working with the image. Provided you configure the RAW importer to develop into 16bit images, which is what you should definitely do first.

Using the autoexposure in the RAW importer clips highlights, which is exactly what you don’t want to happen. Instead, your first tool is “Levels”, where you adjust white and black point so that all intensity levels captured are preserved and snugly fit into the output range. I’d need to show a histogram to demonstrate, which I can’t do here. At the same time I add a Gamma curve, I usually set 1.5 – 1.8 here. To make your life easy you can also use the “Normalize” tool from the “Auto-Correction” menu. It will not do the Gamma adjustment, you’ll need to do that by hand afterwards.

The result is a properly exposed image, but normally it looks flat and uninteresting. So the next step is the Curves tool, where I add contrast by forming the typical S curve, which needs just two points. I deepen the shadows and elevate the highlights just a bit, providing a gentle highlight roll-off that doesn’t introduce harsh clipping and gives the maximum dynamic range the camera can provide. It is worth experimenting with.

If I didn’t use a gray card to set the white balance, the camera will sometimes get it wrong. Now is the time to correct the white balance, maybe only to “warm up” the colors a bit to have a more pleasant impression. It’s a matter of taste.

The last step would be saving the image, but sometimes I also adjust vibrance and saturation of the colors before.

Guys, there are tutorials from digiKam on UserBase, including some materials on handling RAW files (http://userbase.kde.org/Digikam/Tutorials#Working_with_cameras_and_RAW_files). This blog and comment adds a lot of detail. If you will allow us to add it (properly attributed) on UserBase, please record that either here or by emailing annew at kde dot org. Thanks

One of the points about shooting RAW is surely to get a result that isn’t the “burnt highlights, too much sharpening, flat high gama” look that in-camera JPEG conversion tends to give?
For that reason I turn off auto brightness in the RAW import prefs and import to 16-bit, then use the white balance tool, not just to adjust the white point if it needs it, but also to fine-tune the exposure, black point and gama (but with much better control than doing it in the camera).

You also get the option of choosing several different white balance / exposure points to then use the exposure blending tool on, which can let you use a low gama to maintain contrast without burning or blacking out areas of the image.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: