Jump to content

It just doesn't add up


Recommended Posts

I have the dubious task next week of explaining image formats (jpg, tiff, raw) to a group of non-photographers (OK don't ask!).

 

So I did some prep, and came unstuck in the detail. I'd always assumed that for raw files a rule of thumb that the pixel dimensions (width by height) times 3 (red, green, blue) would give a reasonable approximation to the filesize. But this simply isn't true.

 

For example a 5472 by 3448 image (Canon Raw (Cr2)) only occupies 23,300 Kbytes on disk.

 

I've played around with 8, 12,14 pixel depth, and understand that 1K is 1024 bytes, but I cannot make the numbers add up.

 

My conclusion is that although Canon Raw is "uncompressed" it actually uses a "lossless" compression technique (e.g. given a string of identical  pixels it records the colour of one pixel and the length of the string) and expands the string when the file is opened (e.g. in Lightroom)

 

Is my assumption correct? Help needed & much appreciated!

Link to comment
Share on other sites

Yes, Canon CR2 and CR3 files use lossless compression so looking at the filesize is not really helpful. All it tells you is how much detail or noise the image contains as files with lots of detail (grass or sand for example) will be larger than files with lots of sky. But high ISO noise will also make the file larger. Some cameras like Sony does not offer that option, it is either uncompressed (large) or lossy compression, a really bad option.

Link to comment
Share on other sites

16 hours ago, Russell said:

I have the dubious task next week of explaining image formats (jpg, tiff, raw) to a group of non-photographers (OK don't ask!).

 

So I did some prep, and came unstuck in the detail. I'd always assumed that for raw files a rule of thumb that the pixel dimensions (width by height) times 3 (red, green, blue) would give a reasonable approximation to the filesize. But this simply isn't true.

 

For example a 5472 by 3448 image (Canon Raw (Cr2)) only occupies 23,300 Kbytes on disk.

 

I've played around with 8, 12,14 pixel depth, and understand that 1K is 1024 bytes, but I cannot make the numbers add up.

 

My conclusion is that although Canon Raw is "uncompressed" it actually uses a "lossless" compression technique (e.g. given a string of identical  pixels it records the colour of one pixel and the length of the string) and expands the string when the file is opened (e.g. in Lightroom)

 

Is my assumption correct? Help needed & much appreciated!

 

46 minutes ago, vpics said:

 

BTW, I don't use Tiffs but PSD files for layers. 

 

 

As others have said the assumption about file size on disk is correct. I use Nikon where there are 3 options - uncompressed, lossless and lossy compressed. I use lossless compressed raw for everything.

 

However, there are a few caveats in relation to the direct correlation between pixel dimensions in Photoshop (now called simply Dimensions in the Image Size dialog) and the file size on disk.

 

Firstly, and this is stating the obvious (but it is often important to state the obvious,) the relationship only holds for file formats that do not involve any form of compression as you have already discoverd in the case of some raw files.

 

Secondly, the 3x relationship only holds for 8 bit files, it is 6x for 16 bit files. 

 

Thirdly, and this is significant, the direct proportionality surprisingly does not hold for TIFF files as they add on some weight for some reason (that I can't remember offhand). I don't know if the amount they add on is proportional to the pixel dimensions or the  content of the file or both. However, the direct proportionality does hold for non-layered 8 bit PSD files and it is possible to do a simple 3x for the images dimensions and end up with the actual file size on disk. You can test this for yourself easily. I was surprised when I discovered this a few years ago.  The explanation as to why came from David Kilpatrick and I can't remember exactly.

 

As with vpics, I have always used PSDs rather than TIFFs as they are far more efficient for use in Photoshop, especially if there are any layers, and TIFFs are occasionally liable to corrupt. The only good reason I can think of for using TIFF rather than PSD is if there is an intention to stop using Photoshop at some point but as a Photoshop lifer I have no good reason to do so. 

Link to comment
Share on other sites

Another factor to consider that makes a small difference to the file size is that many (most?) RAW files also contain a compressed jpeg version of the image so that file browsers/explorers can quickly display a representative image/thumbnail. There's also the EXIF / IPTC data and there may be lens correction data and camera colour profiles embedded in the RAW file too.

 

Mark

Link to comment
Share on other sites

6 minutes ago, spacecadet said:

Sony do the same- my 20MP RAWs are only 20MB, not 60. There's been some discussion about its causing an odd striping artifact around high-contrast edges. I've noticed it once in a couple of night shots, but it only shows at 200%.

I only shoot uncompressed on my Sony's, the files are 83MB for the 42.2MP sensors.

Link to comment
Share on other sites

2 minutes ago, M.Chapman said:

Another factor to consider that makes a small difference to the file size is that many (most?) RAW files also contain a compressed jpeg version of the image so that file browsers/explorers can quickly display a representative image/thumbnail. There's also the EXIF / IPTC data and there may be lens correction data and camera colour profiles embedded in the RAW file too.

 

Mark

Yes, I do notice small size differences between photos on the Sony's. On my Canon bodies the size varies a lot due to compression.

Link to comment
Share on other sites

18 minutes ago, spacecadet said:

Sounds like they've turned down the compression, then. Uncompressed would be 126-odd.

The files are, according to Sony, uncompressed containing 14bit per pixel data. If you choose the compressed option on the camera (A7R3) the size changes like Canon but unlike Canon it is not lossless so there is some IQ penalty, I have never used the compressed option.

Link to comment
Share on other sites

Unless I completely misunderstand RAW files, the bit depth for 8 bit RAW files would only be 1, not 3.  The sensor pattern consists of red, blue and green  (2 green, 1 red, 1 blue ratio).  So Russel's 5472 x 3448 pixels would give only 18,867,456 bytes.  A somewhat greater bit depth, saw 10 against 8, would take this up to 23.5 MB.  Also, some programs report file size in the computer definition of Megabyte:   2 to the 20th power or 1,048,576 bytes, which introduces another complication.

 

When the conversion is then made from RAW to other formats such as tiff,  each original pixel is replaced by a computed RGB pixel:  3 bytes for 8 bit depth or 6 bytes for 16 bit depth.  Hence the much larger file sizes for tiff versus RAW.

 

Robert

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.