1
\$\begingroup\$

When I have it set to the highest JPG quality, my 8GB card can hold about 1000 images. If I switch to RAW format, it drops the capacity to about 200 images.

So why do images captured as RAW take up 5 times the space of images captured as JPEGs? Is the picture quality that different?

\$\endgroup\$
2
  • \$\begingroup\$ On the last question ("Is the picture quality that different?"), see several of the questions in this list: photo.stackexchange.com/questions/tagged/… \$\endgroup\$
    – mattdm
    Commented May 8, 2011 at 16:23
  • 2
    \$\begingroup\$ For my camera, medium quality JPEG is ≈ 6 MB, and better quality JPEG is 11 MB, Bzip2-compressed RAW is 18 MB (24 MB for uncompressed RAW). So it's often only 2-3 times difference if we are talking about JPEGs of decent quality, but they can surely be compressed as much as you want. Nick Bedford gave a perfect answer. \$\endgroup\$
    – sastanin
    Commented May 9, 2011 at 12:26

4 Answers 4

16
\$\begingroup\$

Raw files are an intermediate format. It's essentially the unmodified sensor data (often in Bayer pattern), packaged with a bunch of metadata about the shot as well as a JPEG preview (for quick viewing). The data is both losslessly compressed and of a higher bit depth than that of JPEG.

You only need to shoot raw if you wish to develop the photos into JPEGs, or other destination formats such as TIFF or PNG, yourself by using a software suite. This has many benefits to photographers wanting to take their photos beyond the camera, as well as provides the ability to extract information that might otherwise be lost. For example, bringing out detail in shadows, bringing back detail lost in highlights.

A raw file is analogous to a film negative in the fact that you can keep producing different versions of a photograph by manipulating settings such as contrast, saturation, white balance, black and white etc.

The main thing to note is that raw files are nothing more than the base data for creating a JPEG representation. They're not some better format of photo, because they're not the format used to print or to upload to the internet. They're the egg and you are the frying pan. Shooting JPEG means the camera fries the egg for you, in a way you may or may not like. I personally don't take the chance.

Main Differences

  • JPEG compression discards information in the image to reduce the size, raw does not.
  • JPEG can only store 8 bits of information per component (red, green, blue), where a raw file may contain 12 - 14 bits for most DSLRs these days. The pixel data in a 14-bit raw file is 64 times more detailed than a JPEG.
  • Changing white balance and many other basic settings can cause severe loss of quality in a JPEG, with raw you are essentially starting from scratch with the highly accurate data.
  • Raw files are typically 2 to 5 times larger because of the compression and bit depth of the data.
\$\endgroup\$
2
  • \$\begingroup\$ The only actual reason is your first point under main difference. Losslessly compressed image should be larger than lossless compressed RAW since you have 3 x 8bit versus 12 or 14 bits per pixel. \$\endgroup\$
    – Itai
    Commented Aug 4, 2012 at 2:34
  • \$\begingroup\$ It's worth noting that "RAW" might not be exactly what the sensor recorded. Take for example Canon's sRAW format which according to the linked DPReview post throws away quite a bit of data to achieve a smaller file size. In Canon, sRAW was introduced with the EOS 40D. True RAW formats record all sensor data, possibly but not necessarily (losslessly) compressed. \$\endgroup\$
    – user
    Commented Sep 30, 2013 at 11:55
4
\$\begingroup\$

RAW files contain the raw data right form the chip (often uncompressed, or otherwise compressed losslessly). They also contains more bits per pixel (usually 12 or more, per color channel) compared to JPEG, which only stores 8bits per pixel & color. These extra bits give you a much wider range of light/dark values, and more granularity within the range of available values, for all three color channels. This is also known a Dynamic Range.

In other words, JPEGs "save" space by login two pieces of information: (a) dropping dynamic range down to 8bit and (b) lossy-ly compressing the resulting data.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ is the word lossy-ly, or losslesslessy? \$\endgroup\$
    – Matt Grum
    Commented May 8, 2011 at 16:07
  • \$\begingroup\$ The key point is that if you take so many bits per pixel, the lowest-order bits will necessarily contain a lot of noise. And if you use a lossless compression algorithm, you cannot compress the noise. Therefore raw files are necessarily large. (Whether it makes sense to actually store all that noise is another question. But the very definition of a raw file is that everything that the camera read from the sensor chip is stored in the file, whether it is useful or not.) \$\endgroup\$ Commented May 8, 2011 at 20:07
  • 1
    \$\begingroup\$ It's not just noise, either -- it's fine detail. Distinguishing between the two is next to impossible, which is why noise reduction algorithms tend to destroy fine detail. \$\endgroup\$
    – Evan Krall
    Commented May 8, 2011 at 21:56
  • 3
    \$\begingroup\$ @Matt Grum: dwarfland did indeed mean to say that JPEGs are lossy. The grammatically correct adverb form of the adjective "lossy" would have been "lossily", however. \$\endgroup\$
    – nitro2k01
    Commented May 9, 2011 at 6:59
  • 1
    \$\begingroup\$ @dwarfland - the RAW file does not contain 12-bit per color per pixel. The information is stored pre-demosaicing, so each pixel is monochromatic. If this is indeed what you meant, I'd suggest making it clearer. \$\endgroup\$
    – ysap
    Commented May 9, 2011 at 17:31
2
\$\begingroup\$

Is the picture quality that different?

Yes, and no.

The RAW file does contain that much more information, but it's more information than is possible to make visible in an image, so you can't see all the difference.

The extra information in the RAW image is useful if you need to process the image afterwards. If the image is underexposed or overexposed, or if you need to change the contrast, the extra information in the RAW image will keep it from degrading as quickly.

If you process a JPEG image too much, you will see the lack of information as banding or compression artifacts. The JPEG image contains just enough information to make it look like it does, all extra information is removed in the conversion to the 24-bit color depth and the image compression.

\$\endgroup\$
1
\$\begingroup\$

JPG files use lossy compression, which means that as well as throwing away some information, they take up less space. RAW is effectively a direct sensor dump - nothing is thrown away or compressed (though some cameras offer a compressed RAW option).

\$\endgroup\$
4
  • 5
    \$\begingroup\$ RAW files are always compressed - but not in a lossy manner (that's why each file is a slightly different size) \$\endgroup\$ Commented May 8, 2011 at 16:01
  • \$\begingroup\$ Interesting - I've seen options for "RAW" and "RAW (Compressed)" so I assumed that they weren't always compressed. \$\endgroup\$
    – Cry Havok
    Commented May 8, 2011 at 21:12
  • \$\begingroup\$ At least in the case of Nikon's NEF files, one has a choice of lossless or lossy compression, and some cameras (again, notably, some older Nikon models) also have the option to turn off RAW data compression. \$\endgroup\$
    – user2719
    Commented May 9, 2011 at 8:26
  • 1
    \$\begingroup\$ In older Pentax models, Pentax-proprietary PEF files were compressed, but DNG was uncompressed. On newer models, both are compressed. (But losslessly in either case.) \$\endgroup\$
    – mattdm
    Commented May 9, 2011 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.