histograms: libraw, dcraw, Capture NX-D

Hi all,

I wish to convert raw .NEF files taken with a Nikon D40. I compared Nikon's Capture NX-D utility, libraw, and dcraw. First, I generated .tiff files with each of these. For NX-D, I converted without making any adjustments. With libraw, I used:

RawProcessor.imgdata.params.output_color = 1;

for dcraw, I used:

dcraw -w -q 3 -T

I then loaded each converted tiff file into "The Gimp" to compare histograms. The histograms for the red channels are found in the attached image. The histograms for libraw and dcraw were very similar, however the dcraw histogram was shifted to the right relative to libraw. The Nikon NX-D historgram is quite different and appears to be have undergone a different transformation (color curve?) than the libraw and dcraw histograms. Also the libraw and dcraw histograms were missing discrete pixel values. Following are my questions:

1. I would like to get libraw to be as close as possible to the Nikon converter and was under the impression that dcraw used the actual (previously encrypted) color curves used by the Nikon converter. is this correct? Then why do the libraw (dcraw emulator) and dcraw histograms not match the Nikon NX-D histogram?
2. Why are the dcraw and libraw histograms missing values?
3. Why is the dcraw histogram shifted with respect to the libraw histogram?

Many thanks.

Image icon dcraw histogram20.49 KB


Image fixed (you need to

Image fixed (you need to check []Display checkbox to display).

LibRaw's and dcraw's images (with same parameters) should be very close (or identical).

For unknown reason you use no_auto_bright for LibRaw and auto-brightening (default) for dcraw. That's why dcraw's histogram is shifted to the right.

-- Alex Tutubalin @LibRaw LLC