A screen shot of TrueRaw running in a command window under Windows XP
Do you want to know what REALLY comes out of your camera? I'm not talking out the image itself, but the actual numbers: the raw output of your camera's ADC. All Raw converters that I have used perform substantial processing; even if they don't apply sharpening and noise filtering they invariably apply some interpolation algorithm in order to pretend that each pixel contains all 3 primary colours rather than the single colour that is the true reality1. Certainly the great majority of photographers are only interested in the image, NOT the numbers or where those numbers might come from and that is precisely as it should be. Nevertheless, there are a few that want to look at the mathematics of image creation and camera physics and it is for them that I created this application.
TrueRaw is a command line program that takes a RAW file from a digital camera and outputs a formatted text file containing all the pixel values in decimal format that are the unprocessed output from the ADC. I used these values to verify my analysis of the Physics of Digital Cameras with particular emphasis on the Poisson behaviour of light.
You can download the Windows executable file (TrueRaw.exe) here. If you haven't already installed the Visual C++ Redistributable Package you will need to download and install it first.
To run the program you should:
- Copy TrueRaw.exe and any Raw files you wish to decode into a directory that is easy to navigate to from the command line, say: C:\temp
- Go to Start/Run and type "command" to bring up the command line window.
- Navigate to the working directory. eg. cd c:/temp
- Type "TrueRaw %f" (where %f is the case-sensitive full name of the file you wish to decode).
- The job is done when the prompt reappears.
- Use a decent programmers editor that can handle large text files to examine the output. TextPad and Notepad++ are both good. (Don't use Notepad.) You may need to turn off word wrap and set up the tab stops to get clean columns.
- Copy the data into a spreadsheet or other statistical tool if you wish. You can even read the data directly with your spreadsheet if it can handle large files. Just open it as a tab delimited text document!
Viewing the output text file using TextPad
When you scroll through an output file yourself you will notice a few things:
- There are four colours instead of 3. This is the Bayer filter mosaic. The two colours that exhibit similar values are the two green channels.
- There are only half the rows and half the columns you expect. This is because when you combine the 4 colour channels into a single full pixel you need to use 4 pseudo-pixels. These means you only get ¼ the advertised number of pixels. Of course you can do as the manufacturers do and invent the 3 missing colour values to go with the single true value in each pseudo-pixel using interpolation, but that would be cheating. Cheating and invention are all very well in their own place, but this little application is only interested in getting the TRUE data, not something that looks good or sounds good.
- "Nominal maximum" is the manufacturer's stated dynamic resolution. In this case it is 16,000 levels or 14 bits, which sounds damn fine! This is typical manufacturer's disingenuous lying. In point of fact the maximum intensity in the image, (which you can see by scrolling through the text file), is about 6,000 or 12½ bits. Your supposed 2 bit advantage over the standard 12 bit DAC is mostly Manufacturer's spin.
- "black" is the offset value that needs to be subtracted from data values to get the true pixel intensity. In most cases this is zero, but in some cameras it is a significant offset. What it is doing there I don't precisely know but I'm willing to bet it is more damn Manufacturer's spin.
This application is a modification of Dave Coffin's technically amazing DCRAW Since his code is open and free so is mine. You can download his code here and mine here.
I have provided a Windows executable above which was current at the time I compiled it, however, the camera world moves rapidly and it may be that some of the latest cameras are not supported. I make no guarantee as to keeping TrueRaw current so if you need an update you can either email me and ask me if I can do it or else take my mod, apply it to the latest DCRAW and compile it for yourself (or get a friendly programmer to do it for you).
If you have Microsoft's Visual C++ (which you can download free here), just do the following:
- Create a new project called "TrueRaw" using the Win32 Console Application template.
- Copy the latest dcraw.c into the project directory
- Add existing item: dcraw.c
- Exclude TrueRaw.cpp and delete
- Insert my function: true_raw_text_out just before the first function in dcraw.c
- Insert the code: true_raw_text_out(ifname); continue; immediately after the call: (*load_raw)();
- Turn off Precompiled Headers in the Project Properties.
- Add the command line option: "/D "DJGPP"" in the Project C++ Compiler Properties.
- Build the project
- Your fresh TrueRaw.exe should be found in the debug directory.