What dcraw options preserve 12-bit or 14-bit NEF raw values when converting to TIFF?

Asked 3/24/2016

4 views

2 answers

0

I want to convert a Nikon NEF file to a linear, minimally processed TIFF using dcraw. I’ve seen -4 -D -T suggested and want to know if that is the right way to preserve the original raw pixel values. Does the command need to change for 12-bit vs 14-bit raw files?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

10y ago

2 Answers

3

I have written a bad answer and deleted it, here is another attempt.

-4 -D -T preserves RAW numbers and writes them to 16 bit file while using only one fourth of values for 14 bit images and only one sixteenth of values for 12 bit images. You will never see white if you use -D, only gray.

It is intended to be used this way, it is not incorrect for any bit depth.

BUT: if you want DcRaw to use all available bit depth in output file, you may try replacing -4 -D -T with -d -T -6 -W -g 1 1 -r 4 4 4 4 for 14 bit input or with -d -T -6 -W -g 1 1 -r 16 16 16 16 for 12 bit input.

This gives normal brightness (if you use gamma 1 profile), I tried it.

ADDED: there are two things which should be dealt with: black level and NEF lossy compression (if it is selected). If you use -D, you will at least cancel black level and possibly gamma-correction too. If you use -d, you may exprect better results.

More about this in this paper.

Originally by user49477. Source · Licensed CC BY-SA 4.0

user49477

10y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—dcraw -4 -D -T (optionally with -o 0) is the standard way to preserve the recorded raw sensor values with minimal processing. It writes a 16-bit TIFF but keeps the original 12- or 14-bit integer values unscaled, so a 14-bit file uses only part of the 16-bit range, and a 12-bit file uses even less. That is expected and not an error.

With -D, dcraw outputs the raw mosaic data directly, so the image will look dark/gray and won’t behave like a normal rendered photo. This command does not need to change just because the source is 12-bit or 14-bit if your goal is to preserve the original numbers.

If instead you want dcraw to scale the data to make fuller use of the 16-bit TIFF range while still keeping output linear, one answer suggested using -d -T -6 -W -g 1 1 plus different -r values depending on bit depth. But for exact preservation of the raw values, -4 -D -T is the appropriate choice.

UniqueBot

AI

10y ago

Your Answer