Canon raw files under linux

I am curious about raw files. In particular, I am curious about the CR2 raw files that get spit out by my Canon 20D camera. Since I am a software guy, I just have to dig in and find out what makes these things tick:
The Canon CR2 format

Bibble

I need to mention that there is a well regarded commercial product called Bibble that amazingly enough is available for linux. (The Pro version is $129, the Lite version is $69, and you can download a copy for a two week trial). I don't have any experience with it, but I sure am tempted to give some business to a company that provides a linux version of what is said to be very good software.

The DCRAW progrm

An open source program called DCraw allows Canon raw files (virtually ANY kind of raw file for that matter) to be processed. It also has a plugin for the Gimp.

Visit the DCRAW. site and download the latest version.

I used to keep the source (dcraw.c), the man page (dcraw.1), and the gimp plugin (rawphoto.c) here, but they change so often that nobody is well served by my doing so. Use the above link to obtain the latest source.

Building dcraw

A naive attempt to compile dcraw fails because it wants lcms.h, but a revisit to the dcraw site tells me to build it with either:

Apparently the NO_LCMS thing disables the -p option, and the NO_JPEG option drops support for the Kodak DC120, so I choose the second line for now and it works fine (but it does take a while to compile with 6500 line program with -O4 optimization). It turns out this is version 8.11 of dcraw, I find version 6.35 in /usr/bin on my Fedora Core 4 system.

Once compiled, place the executable someplace like /usr/local/bin and the man page into /usr/local/man/man1.

To use the gimp plugin, the thing to do is to build and install dcraw, then do:

gimptool --install rawphoto.c.

Be warned (or aware at least) that the stock gimp is an 8-bit tool, so as soon as you begin working with an image using the gimp you have thrown away much of the advantage of using a raw file.

Using dcraw

DCraw takes in raw files and generates 8 or 16 bit PPM's. The following pipeline will generate a JPEG file.

dcraw -c img_0999.cr2 | ppmtojpeg >img_0999.jpg


OK, here is a record of my experimenting with dcraw:

Other links and information

This fellow has made a start at a users manual for dcraw, and you have to take note of his Camera Hacker website. He has even written a book entitled Hacking Digital Cameras.

Here are some other links for further study:

UFraw was available from sourceforge via anonymous CVS and I grabbed a copy via:

cvs -z3 -d:pserver:anonymous@ufraw.cvs.sourceforge.net:/cvsroot/ufraw co ufraw

Joseph Heled (see link above) has forked his own copy of UFRaw (which is itself a fork of DCraw) and written a gimp plugin to go along with it, I believe he is calling it RougePhoto. It may be specific to the Nikon D70.

Little CMS is a color management system that can be tangled into this whole business. Here is a short note on LCMS.


Feedback? Questions? Drop me a line!

Uncle Tom's Digital Photography Info / tom@mmto.org