dcraw

If you only occasionally need to convert a raw file, you don’t have to buy expensive software or install open source converters with all their libraries – just use dcraw!

Dcraw is a little raw converter written by Dave Coffin – hence the first two letters of the name. It exists since 1997 and is updated ever since, so it also supports the latest cameras. Dcraw serves as the base for other raw converters like RawTherapee, Darktable or ufraw. The program is invoked via a terminal, but there is a plug-in called gimp-ufraw that you can use to open a raw file in GIMP. Install dcraw via your software manager or download the source code or some binary versions from his website. Elsewhere on the web you can find versions for Mac OSX and Windows, just use a search machine.

Usage

To demosaic a raw file – as the process is officially called – open a terminal window and navigate to a folder with raw files, then type dcraw rawfile.ext, replace ‘rawfile’ with the name of your photo and ‘ext’ with the raw extension of your camera brand, like cr2, pef, nef, etc., like so:

$ dcraw DSC_1000.NEF

and hit Enter (don’t type that $ sign). This produces a 8-bit file called DSC_1000.ppm (the portable pixmap file format) that can be opened in a photo editor like GIMP. Ah yes, please note that original raw files are never touched or altered by raw converters, they always create converted copies (some refer to this as ‘non-destructive editing’).

Type dcraw to see the version number of the program and a list with commands.

With the -v option, dcraw gets a bit more verbose, like this:

Loading Nikon D7000 image from DSC_1000.NEF …
Scaling with darkness 0, saturation 16383, and
multipliers 2.267915 1.000000 1.217263 1.000000
AHD interpolation…
Converting to sRGB colorspace…
Writing data to DSC_1000.ppm …

Useful options are:

$ dcraw -w DSC_1000.NEF: use white balance setting of the camera that is stored in the raw file; gives usually better results

$ dcraw -T DSC_1000.NEF: write 8-bit tif instead of ppm

$ dcraw -6 DSC_1000.NEF: write 16-bit ppm instead of 8-bit

$ dcraw -T -6 DSC_1000.NEF: write 16-bit tif

Sometimes the result is a bit too bright with washed-out highlights, or too dark with missing details in the shadows. Use the -brightness switch to correct this:

$ dcraw -b 0.8 DSC_1000.NEF: make output a bit less bright
$ dcraw -b 1.2 DSC_1000.NEF: make output a bit more bright

To convert all the raws in a folder to 8-bit tif, using the white balance information of the camera, say this:

$ dcraw -w -T *.NEF

This raw file is converted to a 8-bit tif with a -b(rightness) of 0.6 and the -w option active, like so:

$ dcraw -w -T -b 0.6 DSC_1000.NEF

As you can see the tif looks already quite well and can be further processed in an image editor. Included is a crop at 100%.

DSC_5066.dcraw-b0.6

DSC_5066.dcraw-b0.6.100pct.crop

You can also extract the jpg file that is embedded in your raw file:

$ dcraw -e DSC_1000.NEF

To extract all the jpg’s from the raws in the current folder, say this:

$ dcraw -e *.NEF

With my camera model this option is not very interesting, as the Nikon D7000 stores those thumbnails in the jpg quality low instead of normal or high. That means that at a zoom level of 200% jpg artifacts appear. So thinking “I shoot only raw and extract the jpg’s later” is not a good idea, you’d better instruct your camera to shoot raw + jpg fine.
For other models or brands, this story might be different.

_________
pm|nov15

Advertisements
%d bloggers like this: