PDA

View Full Version : TIF SIZE VS RAW FILES



Bill McCrystyn
01-11-2009, 11:52 PM
Why are 8 bit Tif files uncompressed straight out of my camera so much larger than 12 bit Raw files? :confused:

Roger Clark
01-12-2009, 08:46 AM
In most digital cameras, each pixel is only one color, red, green or blue. The Sigma Foveon is (I think) the only exception (separate discussion of the advantages/disadvantages of that sensor). A tif file has 3 colors for each pixel. From a digital camera image, 2 of the 3 colors in a tif are interpolated from the monochrome raw data. So a tif should be 3x larger. But raw files usually have good compressors. Tif compression does not seem very efficient in my experience, so the size ratio is generally more than 3x.

Roger

Bill McCrystyn
01-12-2009, 09:14 AM
Thanks Roger. Bear with this ignorant laymen. My uncompressed Tif file out of the camera is around 36MB and my Raw file is about 18MB. Does this doubling in size account for the 2 colors per pixel being interpolated. And - are you saying Raw info is being compressed??? Sorry, Im a little lost. Probably allot. :o

John Chardine
01-12-2009, 10:12 AM
Nikon produce lossless compressed RAW files I think. Canon does not.

William Malacarne
01-12-2009, 01:07 PM
According to this I think Canon does compress RAW.

<http: cpn.canon-europe.com="" content="" infobank="" image_compression="" lossless_and_lossy_compression.do="">http://cpn.canon-europe.com/content/infobank/image_compression/lossless_and_lossy_compression.do

Bill</http:>

Jason Franke
01-12-2009, 03:50 PM
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Cjason%5CLOCALS%7E1%5CTemp%5Cmsoh tml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> Bill,
Yes the 2x increase in size is due to the other 2 color channels being stored for every pixel.

You can estimate the size of an uncompressed RAW file, by multiplying the number of pixels by the camera's bit-depth (depends on your camera) and divide by 8 to get it in bytes. For a TIFFs generally the bit-depth given is per channel, so you multiply it by 3 (for the 3 color channels) to get the number of bits each pixel uses.

For example, for a 10 MP 12-bit camera:

An uncompressed RAW file looks roughly like this:
10,000,000 (pixels) * 12 (bits/pixel) / 8 (bits/byte) = 15,000,000 bytes.

An uncompressed TIFF of the same image would look like this:
10,000,000 (pixels) * 8 (bits/color channel) * 3 (color channels) / 8 (bits/byte) = 30,000,000 bytes.

As for compression, by its nature a RAW file is "compressed" in the sense that each pixel only contains data for one color. On top of that most manufactures compress them further (this is true mathematical compression, not just having less data to store), similar to how a ZIP file makes the contents smaller, to save even more space. The actual amount of compression is dependant on the "quality" of the data being compressed, the more uniform the data the more it will compress (a picture of an even blue sky taken at ISO 100 will compress to a smaller file than a picture with a lot of noise and color variations).

Hope that helps a little.


Nikon produce lossless compressed RAW files I think. Canon does not.

Canon's RAW files are, as far as I know, losslessly compressed going back as far as I know. They certainly are on all current bodies.

Nikon had two options prior to the D3 and D300, "lossy compression" and "no compression". The D3/D300 added "lossless compression" similar to what Canon was doing all along.

As an aside, Nikon's "lossy" compression is probably the most novel, interesting and least understood by photographers solution to compressing RAW files without a measurable loss of quality. The lossy compression algorithm makes use of some really novel data modeling, the properties of photon shot noise and the linear mapping of RAW values to collected photons to reduce the number of bits necessary to store the 12- to 14-bit output of the sensor. It's very cool when you dig further into it.

Bill McCrystyn
01-12-2009, 06:23 PM
OK, thanks Jason. The math helped me understand how to attain the MB count and the compression is easy enough to understand. With my D300 I shoot both formats uncompressed.

Apparently I need to understand Raw processing. I guess a basic digital book for dummies. I have been shooting DSLR's for 6 years and have spent most of my time learning PS and from the masters here how to take a picture. Now that I'm getting a little more into the hardware I want a better basic understanding. Raw imaging is confusing me a little.

Anybody that knows a good book with lotsa pictures would work. Or maybe Roger has more to say. :D

Roger Clark
01-12-2009, 08:40 PM
Bill,
V Jason gave the details very well. The main difference in the generic 3x difference I cited and 2x is the fact that the raw is 12 bits, and the tiff is 8.

Compression is a different story. There are lossless and lossy compression algorithms. jpeg is lossy. Gif, and tif compression is lossless (gif is limited to only 256 total colors). Most digital cameras produce lossless compression on the raw data. All Canon raw files are compressed with lossless algorithms. Some Nikons do a table lookup giving 660 or so levels, then a lossless compression (fewer levels mean better lossless compression). 12-bit raw data will compress better than 14-bit raw data.

So file size is a function of number of pixels * number of colors per pixel * number of bits per color * compression factor.

Roger

Bill McCrystyn
01-12-2009, 10:13 PM
Thanks everyone. I understood the basic concept of pixels and Bayer RGB interpolation but Raw doesn't seem to correspond with this process at all but in a world all it's own. I need a book showing from the light hitting the image sensor and then what happens. Any suggestions??

Jason Franke
01-12-2009, 10:52 PM
Thanks everyone. I understood the basic concept of pixels and Bayer RGB interpolation but Raw doesn't seem to correspond with this process at all but in a world all it's own. I need a book showing from the light hitting the image sensor and then what happens. Any suggestions??

Take the output of the sensor, write it to a file, you have uncompressed RAW. No demosaicing or interpolation is done, it's just the data that was recorded by the sensor in the order it was recorded. If you understand the organization of the Bayer array, you can visualize a RAW file as just being the values it (the Bayer array) recorded in the same order. The Bayer interpolation is done by your RAW processing software (Lightroom/ACR/DPP/CaptureNX/etc.) instead of the camera like it would be in a TIFF file.

Unfortunately I have no idea what book to recomend, maybe someone else can chime in with that. I think this is likely covred in most of the intro level digital photography books in a couple of paragrpahs somewhere. This article (photo.net (http://photo.net/learn/raw/)) might help clear up some of what's going on in the mean time.

Bill McCrystyn
01-13-2009, 12:01 AM
Ah, so your saying my ACR has a profile somewhat like a DNG to render the color gamut and produce the image? If so, why is this method any more accurate than RGB interpolation?

I just ran a test on Raw: D300 - Lossless 14.20MB / Uncompressed 19.48MB

I'll read your article - thanks.

Bill McCrystyn
01-13-2009, 10:10 AM
I see said the blind man. Good article. Sent me off in the right direction out of the forest.

Now, being my suspicious self I am wondering if lossless is so good - why do they even bother to offer "no compression"?

Jason Franke
01-13-2009, 10:24 AM
No compression is a holdover on the D300 from when the only options were lossless and lossy. If I was in charge of Nikon I probably would have just dropped the no compression options because in my opinion it's useless when you have lossless compression. I think they may have kept it to insure that they didn't break some tool out there somewhere that only supported no-compression. If you got the space (either in the field and on your computer) I'd just leave the camera in lossless compression and forget about it.

I think Nikon's lossy compression is rather novel, and probably the way RAW formats should have been designed in the first place. There's a really good exhamination of the effects of lossy v. no compression here (http://regex.info/blog/photo-tech/nef-compression). I think much of the bad rap it gets is because they called it lossy compression and not something else, and because most photographers haven't spent enough time leanring about light and photon shot noise to be able to understand what's going on. That being said, Mr. Clark is more qualified than I am to go into the details on this.

Bill McCrystyn
01-13-2009, 10:42 AM
Thanks Jason. Few here are more qualified than Roger on these issues. By the way, welcome to BPN, you'll enjoy it here.