Software for Digital Cameras

What is a digital camera?

Like a traditional camera, it has a lens, shutter, light meter, and viewfinder. But at the plane where the light comes into focus, there is no plastic film covered with light-sensitive chemicals. Instead, there is a light-sensitive silicon chip (called a "CCD") connected to a special computer.

After closing the shutter, it takes several seconds to off-load the CCD data, analyze it, and save the result to permanent memory. Then the same CCD is ready to take another picture. The entire apparatus is endlessly reusable. Although digital cameras cost more than their chemical forebears, the lack of film saves money for those who take a great many pictures.

The other advantage of digital cameras is their immediacy. Depending on your hardware, you can see a photo seconds after taking it. Even Polaroid can't acheive that, so they recently went bankrupt and laid off all their employees.

Having captured the data from the CCD, the camera has two choices:

In general, camera costing less than US$400 offer only the first choice, while higher-end cameras offer both.

My story

After two years of research, in February 1997 I finally bought a CanonPowerShot 600, the first consumer digital camera with images sharper than an American television.

Here's the problem: With my Linux computer, it was easy to view JPEG images, but Canon's software for processing raw images only worked in Windows. So I examined the raw files, and wrote code to decifer and process them. My first attempts were pathetic, but at the end of August 1997, I figured out the right algorithm to make high-quality pictures.

In April 1999, a man in Moscow asked me for help with his new PowerShot A5 camera. He e-mailed me some raw photos, and I reworked my program to decifer them:

Canon PowerShot 600 (badly)		 2/1997
Canon PowerShot 600 (well)		 8/1997
Canon PowerShot A5			 4/1999
Canon PowerShot A50			 5/2000
Canon PowerShot Pro70			 5/2000

Then disaster struck: Canon cameras started compressing their raw data. Where once there were visible traces of an image in the raw file, now there was only a shapeless mass of ones and zeroes! My old techniques were useless, so I had to find new ones. After months of work, I announced success on September 24, 2001:

Canon PowerShot Pro90			 9/2001
Canon PowerShot G1			 9/2001
Canon PowerShot G2			 9/2001
Canon EOS D30				 9/2001
Canon PowerShot S40			10/2001
Canon PowerShot S30			11/2001
Canon EOS D60				 4/2002

The next camera had a different format, but this time Canon used a standard algorithm: "Lossless JPEG", a forgotten cousin of the aforementioned "Lossy JPEG":

Canon EOS-1D				 1/2002

Most recently, I reverse-engineered the compressed raw files of the Nikon D1X, using a method similar to the seven Canons above:

Nikon D1X				 3/2002
Nikon D1				 4/2002
Nikon D1H				 5/2002
Nikon D100				 6/2002

Other brands and models followed -- you can find the full list here.

Meanwhile, Canon and Nikon continue to ignore the needs of today's photographers and tomorrow's historians by providing neither documentation nor human-readable code for their "secret" formats. My unpaid, often arduous work aims to correct this error, ensuring that the photographs of our time will always be viewable, on any computer running any operating system.

Here's my program, "dcraw.c". Its language is ANSI C (the most universal computer language, if no longer the most fashionable), with comments in English. If future computers don't understand C, it's not hard to translate it into another language.