The Canon CR2 raw format

Typing file img_0999.cr2 on my linux system tells me
img_0999.cr2: TIFF image data, little-endian
So this is a starting point, the thing to do is to learn about the TIFF file format. Indeed, it turns out that CR2 files are indeed TIFF files of a particular sort. There are many sorts of TIFF files, TIFF is really just a framework for setting up graphics files.

At this point I have written a simple TIFF decoder that is able to read and parse Canon CR2 files. I have learned that within the CR2 file emitted by my Canon 20D is a 1536x1024 pixel JPEG thumbnail. Also the raw image is stored as lossless JPEG. There is EXIF data in there, and other things I have not yet fathomed.

As an aside, there are also Canon raw files in CRW format. These are a whole different beast, but nicely there are some documents describing them:

Since my camera doesn't produce these and I am not even sure which Canon cameras do produce them, I won't discuss them any further.


Also related (if you want to study dcraw) are:

Feedback? Questions? Drop me a line!

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