# The structure of a CR2 file



## DominoDude (Nov 16, 2014)

First, I may have placed this in a thread / topic in which it don't belong. Feel free to inform me or move it (if you have such powers). Was the best I could figure out for now, and no search returned anything showing the same or similar content.

For those who want to waste a few hours, or if you just *need to know* all and everything about what can be found inside a typical CR2 file and which structure it has, then you might enjoy some information found here -> http://lclevy.free.fr/cr2/
It is presented as a work in progress, so take it for what it is.

There should be some "But I knew that already", a few "Oh, that's interesting", and perhaps even a "Bah, who cares".


----------



## Stu_bert (Nov 16, 2014)

Thanks for posting


----------



## lintoni (Nov 16, 2014)

Nice find, thanks for sharing it.


----------



## Click (Nov 16, 2014)

Good info. Thanks for sharing.


----------



## sanj (Nov 16, 2014)

On behalf of all the geeks on this forum I thank you for posting this.


----------



## Marsu42 (Nov 16, 2014)

DominoDude said:


> It is presented as a work in progress, so take it for what it is.



You might want to check with Phil Harvey's exiftool site and the Canon maker notes there, he's also done a lot of research and it's the most complete list of Canon props I know. If your list is better than his, let him know so he can amend exiftool with your information.


----------



## RustyTheGeek (Nov 16, 2014)

OK, that's pretty cool/neat. A great reference! It also might explain a little bit why every new model has a different RAW file that we have to wait for aftermarket software developers like Adobe to decode/reverse engineer.

What I really wish that Canon, Nikon, Pentax, etc would do is change their stance on the RAW file being proprietary and issue a SDK (Software Development Kit) for all 3rd party software companies to use in advance of the release of a new camera model so they can release software updates quickly. In other words, offer software support and cooperation to make new camera releases a smoother experience for everyone.

It's ludicrous for Canon, et al. to assume that any serious photographer will not use a program like Photoshop or Lightroom on their images. In other words, Canon's "competing" image software is only an anecdotal answer and so should not be considered a reason to limit support for "competing" aftermarket editing software. Keeping the RAW file a secret simply makes everyone's life difficult and I assume slows down sales of a camera as well. Many photographers will simply wait to purchase until Adobe, et al. have support ready for that new camera. So Canon is actually hurting their own sales over a petty file format/software policy.

Anyone else have a different take it this? Am I missing something?


----------



## lintoni (Nov 16, 2014)

RustyTheGeek said:


> OK, that's pretty cool/neat. A great reference! It also might explain a little bit why every new model has a different RAW file that we have to wait for aftermarket software developers like Adobe to decode/reverse engineer.
> 
> What I really wish that Canon, Nikon, Pentax, etc would do is change their stance on the RAW file being proprietary and issue a SDK (Software Development Kit) for all 3rd party software companies to use in advance of the release of a new camera model so they can release software updates quickly. In other words, offer software support and cooperation to make new camera releases a smoother experience for everyone.
> 
> ...


Given that Canon offers Lightroom with some of its bodies, it does seem like a stupid way of doing things.


----------



## DominoDude (Nov 16, 2014)

Marsu42 said:


> DominoDude said:
> 
> 
> > It is presented as a work in progress, so take it for what it is.
> ...


I think ExifTool is "ganz genau" on par with the information I found here, but ExifTool is more commonly known, so I added this snippet to broaden the knowledge in the geek in us.
If nothing else there is a cross reference section; that is always a good sign that the facts and information is valid and usable.

____
I've used ExifTool since early on this year, and could still make use of a few bat-files to ease that manoeuvre - I keep poking around at all the wrong places with a not so smart use of options/flags. As soon as I manage to get some structure into that I will create myself some useful scripts. For now, too much change between the sessions so I just run directly from the prompt and fiddle with options until I get temporary fixes to whatever problem or question I had.


----------



## DominoDude (Nov 16, 2014)

RustyTheGeek said:


> OK, that's pretty cool/neat. A great reference! It also might explain a little bit why every new model has a different RAW file that we have to wait for aftermarket software developers like Adobe to decode/reverse engineer.
> 
> What I really wish that Canon, Nikon, Pentax, etc would do is change their stance on the RAW file being proprietary and issue a SDK (Software Development Kit) for all 3rd party software companies to use in advance of the release of a new camera model so they can release software updates quickly. In other words, offer software support and cooperation to make new camera releases a smoother experience for everyone.
> 
> ...



Si si. A CR2 file is much like a big Pelican case with slots for all and everything, and with a table of content hanging on the inside of the lid describing where everything is and how big it's supposed to be. It would/should be extremely easy for Canon to make this common knowledge, and it would certainly make it easier for a handful of existing software designers and future appl makers. In no way would it compromise the inner workings of Canon nor take away from what they do best (making slightly too noisy sensors that we grind our teeth over  ). Done right, it could even give them a good amount of goodwill.

I haven't looked into the other existing formats from other manufacturers, nor the general DNG format, but I would assume that they are not all too different from each other.


----------



## Marsu42 (Nov 16, 2014)

DominoDude said:


> I haven't looked into the other existing formats from other manufacturers, nor the general DNG format, but I would assume that they are not all too different from each other.



The dng format is made to be independent from manufacturers, and as far as I've looked into it I really like what Adobe does here. You have a some choices (embed thumbnail or not, fast load data) that makes it "better" and more flexible than cr2. Last not least, the lossy dng format with still lossless wb operation is great.


----------



## marcel (Nov 16, 2014)

Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.
I use DPP to make a TIFF, and then i open it in Ps.
The attached example is from a test from a 90 x 135 cm print size left ACR right DPP.
The printer is an HP Z3200 camera EOS 5D
I decided to buy the printer when the lab said "12 mpx is not enough, you have to buy another camera".


----------



## Marsu42 (Nov 16, 2014)

marcel said:


> Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.



You're definitely doing something wrong there. ACR has very good denoising, as far as I remember it has even improved in the latest version(s). Denoising and sharpening parameters cant take some trial&error tweaking, and you might to have the denoise brush for some areas. And DxO's PRIME might be better for high iso. But having said that, I'm sure dpp cannot be that superior.



marcel said:


> I decided to buy the printer when the lab said "12 mpx is not enough, you have to buy another camera".



As far as large print go - yes, I guess for 90x135cm (~a1+) 12mp is bordering on too low resolution, but it really depends on how much detail your scene has and from how far away you view it. Lucky me I never go beyond a3, so my 18mp is enough even after some amount of cropping.


----------



## marcel (Nov 16, 2014)

Marsu42 said:


> marcel said:
> 
> 
> > Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.
> ...



This is what I thought before having the printer in my house.


----------



## Marsu42 (Nov 16, 2014)

marcel said:


> This is what I thought before having the printer in my house.



Indeed, I don't doubt you've spend some though on this - but the apparent immense difference from your screenshots is worthy of a troll posting . I hope we'll get more input into this, I never used dpp and can only tell about the acr side. It's not like Canon has some secret anti-noise weapon hidden in their cameras or post software.

Edit: Imho you should open a new thread in the postprocessing section about it, few people will this off-topic issue in a "cr2 structure" thread.


----------



## RustyTheGeek (Nov 16, 2014)

marcel said:


> Marsu42 said:
> 
> 
> > marcel said:
> ...



Where do you live? I might have to drop by unannounced with a few 'test files'!


----------



## marcel (Nov 17, 2014)

Marsu42 said:


> marcel said:
> 
> 
> > This is what I thought before having the printer in my house.
> ...



if I were a troll would write in the Adobe forum. 

I think is not off-topic. From the page linked in the first post:
"Why writing a document to explain the CR2 format and why not just asking to Canon ? Canon do not want to release the official specification of the format for "Intellectual Property" reasons." 

People think adobe can not go wrong, it is taken for granted. It is much easier to accuse me to be a troll.


----------



## Marsu42 (Nov 17, 2014)

marcel said:


> I think is not off-topic. From the page linked in the first post



I didn't write this to rant at you, just to state that most CR regulars with insight into this nr matter won't find this discussion in this thread, and thus we won't be able to pin down the problem.

Btw I'm not such a fan of software monopoly Adobe, but I cannot deny their raw workflow and library management with LR is stellar (I couldn't run anything else on my old laptop anyway).


----------



## privatebydesign (Nov 17, 2014)

marcel said:


> Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.
> I use DPP to make a TIFF, and then i open it in Ps.
> The attached example is from a test from a 90 x 135 cm print size left ACR right DPP.
> The printer is an HP Z3200 camera EOS 5D
> I decided to buy the printer when the lab said "12 mpx is not enough, you have to buy another camera".



I print big all the time, you are doing something wrong for there to be that kind of difference between the two.

In my experience DPP can be very slightly better than ACR on some files, but the difference is so small I practically never bother using it. For there to be such a noticeable difference, not just in the noise but in the contrast and detail as well, means there is something wrong.


----------



## dgatwood (Nov 17, 2014)

So wait, if I'm reading this right, Canon's CR2 files (in true RAW format) provide two greyscale images, each of whose pixels alternate between subpixels shot with two different color filters, and compresses those images in a lossless JPEG? No wonder the RAW files are so big. What they're doing is basically like using JPEG or MPEG compression on an interlaced video image without deinterlacing it first. When you do that, you give up almost all of the spatial redundancy that would otherwise be removed by compression, at least in one direction.

Four color channels is sensible. Three color channels (fold the greens together), would make some sense (though they would be different sizes, and the spatial redundancy would be a little screwy), but two channels is just plain wrong.... How could that possibly make sense?


----------



## marcel (Nov 17, 2014)

privatebydesign said:


> marcel said:
> 
> 
> > Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.
> ...



I think the problem is that certain things happen to certain parameters of certain cameras. The criterion can not be applied to everything in ACR. It is logical because Canon do not want to release the official specification of the format, must be understood until about Adobe and others have gotten interpret or guess what is a CR2 without the collaboration of Canon.
The contrast and detail feeling in the tests is given by the grain noise generated by ACR.
I also have Raw Photo Processor 64 and Raw Therapee ( more complete than ACR ), but DPP is always better!


----------



## privatebydesign (Nov 17, 2014)

marcel said:


> privatebydesign said:
> 
> 
> > marcel said:
> ...



I disagree. I have never seen that much difference between two files without substantial differences in the various settings, sure you can make anything look as bad as that (in any program), but not without trying unless you have an issue.

I agree that DPP can be better, but not by such a large amount, there is some other issue or setting that is making the differences so dramatic.


----------



## marcel (Nov 17, 2014)

I disagree. I have never seen that much difference between two files without substantial differences in the various settings, sure you can make anything look as bad as that (in any program), but not without trying unless you have an issue.



There is always a first time.


----------



## privatebydesign (Nov 17, 2014)

marcel said:


> I disagree. I have never seen that much difference between two files without substantial differences in the various settings, sure you can make anything look as bad as that (in any program), but not without trying unless you have an issue.
> 
> 
> 
> There is always a first time.



Only if your 5D is different from all the other 5D's. Share a RAW file you are having issues with and I will prove you wrong.


----------



## DominoDude (Nov 17, 2014)

marcel said:


> Since I have a large format printer I've realized that raw processed with ACR are very noisy while the same raw processed with DPP can be enlarged without problem.
> I use DPP to make a TIFF, and then i open it in Ps.
> The attached example is from a test from a 90 x 135 cm print size left ACR right DPP.
> The printer is an HP Z3200 camera EOS 5D
> I decided to buy the printer when the lab said "12 mpx is not enough, you have to buy another camera".



Interesting. You have managed to get quite a long way away from my original idea of this topic. Seems like it's more about getting the best proper workflow in different software to render the same or similar output.
For example: If I import a set of data from a .csv file to Excel, and then does the same in OpenOffice Calc, I can't be certain that the defaults of those programs import and treat the raw data in the same way. If I after that decide to crank the formatting a bit here and there in those programs, then I can be even less sure that the outcome looks and behaves the same. At this point there have been many changes and some of those are interpretations by software, and yet again others are subjective changes made by user.

I believe you when you say you get different results in different software, but I have difficulties seeing that a change of content structure in the .CR2 file would minimize or even eliminate that.


----------



## Marsu42 (Nov 17, 2014)

privatebydesign said:


> Only if your 5D is different from all the other 5D's. Share a RAW file you are having issues with and I will prove you wrong.



+1, I'm interested in this, too. Like written above (and pdb agrees), there has to be something amiss in your acr settings to get such a big difference.


----------



## LDS (Nov 17, 2014)

RustyTheGeek said:


> OK, that's pretty cool/neat. A great reference! It also might explain a little bit why every new model has a different RAW file that we have to wait for aftermarket software developers like Adobe to decode/reverse engineer.
> ...
> Anyone else have a different take it this? Am I missing something?



I do not believe Adobe has to reverse engineer new formats anymore, I guess Canon is giving it access to RAW files format, probably under an NDA. When some tools become so widespread among professionals, it would be a bit silly not to cooperate with their makers. DPP is a good tool for its price  but it cannot compete with LR or PS or other tools for professional use.

Just Adobe prefers to process the raw data with its own algorithms and calibration data, thereby it could take a little before support is available. Calibration data can be established on production cameras only, even if they hae access to pre-production ones something may change.

There's a Canon SDK available (http://www.usa.canon.com/cusa/consumer/standard_display/sdk_homepage), I don't know how much access to RAW data it gives, though.


----------



## Marsu42 (Nov 17, 2014)

LDS said:


> There's a Canon SDK available (http://www.usa.canon.com/cusa/consumer/standard_display/sdk_homepage), I don't know how much access to RAW data it gives, though.



One CR regular (I don't remember who it was) wrote that Canon's sdk is a problem because they keep changing their cr2 structure and whatnot. Thus, it seems to be hard to code universal apps working with all cameras - probably one big point in favor of Adobe's dng.


----------

