Sunday, January 11, 2009

RAW vs. JPEG

I wanted to start off my photography tutorial series by discussing the two most widely used file formats for digital images. JPEG is the most widely used and the default format for most digital cameras. RAW is a newer, manufacturer proprietary, file.

There are advantages and drawbacks, which I'll discuss in a moment, to shooting in either format. I shoot in both formats, depending on the situation. For my landscapes, portraits or any other subject I plan to do extensive post-processing, I always shoot RAW. Anything I shoot that I want to be able to make prints straight from my CF cards, I shoot in JPEG.

Let's start, by looking at JPEG
• JPEG is a universal image format and is readable by any image processing program that supports the JPEG Format.
• JPEG is a lossy, compression format.
JPEG is a relatively small file size. An 8 mega pixel camera produces a file between 1 and 3 MB
• Your camera firmware does the image processing.
JPEG is lower in dynamic range, but higher in contrast
JPEG is a slightly sharper file.

JPEG stands for Joint Photographic Experts Group, which was a committee formed in 1986 to create a digital image compression format that would be used as an industry standard. A statement was issued in 1992 and approved in 1994 as ISO 10918-1. This ensures that your JPEG files will be readable by any device that supports the JPEG format — Kodak Photo Kiosks, digital picture frames, stand-alone photo printers, cell phones, computers, etc.

However, JPEG is a lossy compression format, meaning that come of the color and detail in the image are lost. When saved at a higher compression ratio — a larger file size — the loss in quality isn't noticeable to the human eye. I've made prints up to 11x14" that were very high quality. However, the loss in quality is apparent in 20x30" or larger prints.

To create a JPEG you digital camera has what it called firmware, or software that is part of the hardware inside the camera. It's this firmware that carries out all of the complex mathematical calculations required to create a JPEG file. The firmware processes three sets of compression algorithms and combines them to create the JPEG.

If you're not interested in the mathematics, just skip the next three paragraphs.

The first series of compression is lossy. The firmware converts the image to the YCbCr color space, which is the same color space as digital color television. The Y channel represents the brightness of the image and the Cb and CR channels represent the chrominance of the image. Humans see more detail in the brighter parts of the image than they can in the color of the image. So, the firmware down samples the three channels in a 4:2:2 ratio. What this means is that you lose a lot of color from the image in this step.

The next step in creating a JPEG involves two sets of compression called the Discrete Cosine Transformation. The DCT breaks the image into a series of 8x8 pixel grids and saves them in an array. For each 8x8 grouping, the pixel values are averaged, and the entire 8x8 pixel group is converted to the average value. This step results in loss of color and detail in the image. To complete the DCT, a lossless form of run-length compression called entropy coding is used. This coding takes a zig zag pattern across the image's DCT array from the top left to bottom right. The way the compression works is that if 10 8x8 pixel groups in the array have the same pixel value, it compresses these 10 groups into one unit. The end result of this step is an extremely small JPEG file.

The end result is that you have high quality JPEG files that can be printed up to 11x14" with no noticeable image quality loss. You JPEG files are also written in an industry standard format, so any device supporting the format can read it. The files are also much smaller, so you can save more pictures in less space.

The drawback is that you have lost so much data during compression, you're very limited in the amount of post processing you can do to correct mistakes you made while capturing the image.

Now, let's look at RAW
• RAW is not an actual image file, it’s usually a camera manufacturer’s proprietary format and requires special software to view the file. When cameras with RAW first hit the market, it was very difficult to find software to read the file. Today, getting hold of that software is relatively easy, and in most cases free. Adobe Photoshop CS2, CS3 and Photoshop Elements 3.0 and later have RAW conversion software built into the application.
• RAW is an uncompressed, loss less file. The camera records all of the sensor data, so if you have and 8 mega pixel camera, it will produce an 8 MB RAW file.
• RAW captures a wider dynamic range — meaning more detail in the highlights and shadows.
• RAW is lower in contrast and not as sharp.
• RAW files are read only and require post-processing. The post processing information is recorded in an XMP file that accompanies the RAW file.

RAW isn't an actual image file, it's a record of all of the data a digital camera's sensor recorded. You need special software, like Adobe Photoshop CS3, to convert this data into an image and to do any additional post processing.

The main advantage of RAW is that you have all of the sensor data, giving you complete control over the processing of your image. I'm going to explore these options deeper in a tutorial on using Photoshop CS3's RAW converter.

The downside, like I said, is that RAW is not an industry standard format, so 10 or 15 years from now, you may not be able to find any software to read these files. You can't print or use RAW files with commercial products like Kodak Photo Kiosks, digital picture frames, stand-alone photo printers, cell phones, computers, etc. — the same products that readily accept JPEG.

I recommend converting all your RAW files to a lossless, industry standard format, like TIFF, and saving them on a backup hard drive or Compact Disc. When doing this, self-edit your images very, very hard and toss out any images that aren't up to your standards.

RAW are also exceptionally large files, so it takes longer to write them to the CF card and you get far fewer files per card compared to JPEG. This will cut your frame rate dramatically if you're shooting in bursts because your camera's buffer will fill up and prevent you from shooting anymore images. This makes RAW a very bad option for shooting sports or events where you will be taking a lot of pictures at a very fast rate.

Overall, RAW gives you complete creative control, but JPEG is the more practical shooting format.

No comments: