5

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)?

  • 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
8

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.

  • 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
  • 1
    I don't think -o 0 does what is implied here. That defines the output color space to be the native primaries of that camera, rather than sRGB or something else. It doesn't mean no interpolation. – mattdm Aug 10 '15 at 1:51
0

You may consider trying RawDigger, it allows to export TIFFs in 16 bits without any scaling and in linear gamma if you wish. It also calculates statistics if you need it.

  • 1
    It's not free any more though, unfortunately, but it was a nice program when I tried it. It didn't seem to do anything more than dcraw though, other than adding a GUI. Are you one of the devs? If yes, you should make that clear in this post. – Szabolcs Jun 1 '14 at 21:33
  • Yes, I'm one of the developers, sorry if it was not clear. But I signed my post with my full name. The program does much more than dcraw, it is more accurate (for example, when it comes to black level calculations), and it allows grids, histograms, and statistics. It is easier to control, too. Quite often 30-day free trial is enough for a study of any particular sensor issue, or to verify a method. – Iliah Borg Jun 2 '14 at 17:43
  • 3
    I was just warning you: it's standard practice on SE to note if you're the developer, especially if it's not a free program. Otherwise someone might flag it as spam. (I won't do that, but since you're new here I thought it's fair to mention it.) – Szabolcs Jun 2 '14 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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