Time to be with your loved ones

Time to be with loved ones

by sat

submit your photo

Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

What is the simplest way to access the data in a raw file before demosaicing and write it to a more widely supported file format (e.g. 16 bit TIFF)? I'm looking to obtain a single channel image where each pixel corresponds to a single pixel on the sensor (regardless of what colour filter it had in front).

The not so simple way would be digging into some open source RAW processing libraries and using code from there. Is there a simpler way (e.g. a command line tool)?

share|improve this question
Solutions requiring MATLAB/Mathematica are also useful. I tried these on NEF, which is supposed to be TIFF based, but didn't manage to extract anything else than the preview. –  Szabolcs Jul 30 '13 at 20:39
add comment

1 Answer

up vote 6 down vote accepted

dcraw is what you want. Probably using -o 0 which will provide raw color data and possibly -D for an unscaled grayscale image. libraw is extracted from this code and will provide lower level access to a raw file, but will need more coding.

share|improve this answer
Thanks, it's precisely what I wanted. It's part of MacPorts so it was easy to install. I used -o 0 -D -T -6 which outputs 16-bit TIFF. –  Szabolcs Jul 30 '13 at 20:59
I was playing with detecting cosmic rays and I wanted to get access to the original data, without any (in this case) meaningless colour information or smoothing. –  Szabolcs Jul 30 '13 at 21:11
Glad I could help, I have written a few attempts at image processing "for fun", but Adobe is almost always better at it :-) –  Patrick Hurley Jul 30 '13 at 23:57
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.