Saturday, September 13, 2008

G9 File Size

.
The image produced by the G9 is 4000 pixels x 3000 pixels for a total of 12 million pixels. We say that the G9 is a 12 megapixel camera; I usually write this as 12 MP. So a G9 image file would be 12 megabytes (MB), right? Well, not necessarily and probably never exactly.

The in-camera JPEG file produced by the G9 is roughly 5 MB in size for the “Large, Superfine” description. Page 261 of the G9 manual gives estimated file sizes for the various JPEG and RAW settings but these are only estimates. The file sizes are smaller than might be expected because, as noted previously, JPEG files are not only compressed but also are lossy; that is, some data is discarded during the compression process. The results of the mathematical algorithm for lossy compression vary with the content of the image file. In other words, file size varies with the picture so you never know the file size until after the picture has been taken.

To see for myself how the file size varies, I put my G9 on a tripod and photographed a mundane scene of my messy bookcase – which you will not get to see. I set the G9 on Large, Superfine JPEG, wide angle, manual exposure at 1/10 second, f2.8, auto white balance and took 22 pictures. Why 22 pictures? Well, I varied the contrast, sharpening and saturation for every picture. File sizes ranged from 4561 KB to 5741 KB. Remember: the scene and lighting was identical for each picture.

Using My Colors, I varied the Custom Color setting for contrast, sharpening and saturation. For those settings, considering the mid-point (“Normal”) as being zero (0), I took pictures at the low extreme, the Normal and the high extreme; I think of these settings as being -2, 0, +2. Here are some examples of files size:

Cont Sharp Sat Size, KB
0 0 0 5142
-2 -2 -2 4596
-2 -2 0 4561
-2 0 0 5070
0 +2 0 5532
0 0 +2 5265
+2 +2 +2 5565
-2 +2 +2 5741

In comparison, a RAW file was 13,600 KB and the accompanying JPEG at Large+Fine (not Superfine) was 3089 KB when the settings were 0, 0, 0.

A quick linear regression analysis shows that the amount of sharpening has the most significant effect on file size, followed by saturation. Contrast has the least effect on file size. (Note: The linear regression does not provide an exact match. It predicts the smallest file size at -2, -2, -2 and the largest at +2, +2, +2; however, the correlation is pretty good.)

My explanation? Sharpening tends to increase apparent detail and those details – whether real or not – are not as compressible. I was a little surprised by the effect of saturation and contrast. I actually thought that reduced saturation and contrast might increase the file size but this was not the case. Finally, there is a cross correlation between these three variables but it is not very significant with regard to file size.

My conclusion? I still shoot mostly in RAW mode. When I do shoot in JPEG, I usually leave the contrast, sharpening and saturation at “Normal” but this is more of a convenience than a strong preference.
.

3 comments:

Simon Block said...

Gordon,

the sharpening will increase the file size because it is introducing more high frequency components to the JPEG. The DCT (discrete cosine transform) stage of the JPEG encoding process will result in a spectral histogram that is then quantized and then huffman encoded. If you diminish the high frequencies (like softening an image) then you reduce the higher frequencies that are then potentially quantized out. As this data is effectively thrown away the file size reduces. Sharpening has the reverse effect on the spectrum of the image and hence the file size. Your observation is correct but I thought I'd contribute to the explanation.

Gordon Buck Jr. said...

Thanks for the details, Simon. Does this also apply to the larger file size at high ISO because the noise adds high frequency components to the JPEG?

Unknown said...

can you try rawzor on your raw images?