JPEG vs Raw

In high end (and some mid-level) cameras the debate between shooting in RAW and JPEG rages. This article attempts to shed some light on the differences and when to use what format.


Intro 

My masters degree is in computer engineering with a specialty of video and image compression, so this is a topic near to my heart. There are hundreds of image formats out there, some of them are compressed and some are not. Any uncompressed image will be a huge file. Even a 1 megapixel camera will produce a large 8 megabyte or so file when it is completely uncompressed. RAW is not an uncompressed file format in Nikon (and every other camera) I’ve looked at. Many people make this mistake of calling it uncompressed. This is likely because people tend to think of compression as being lossy, and RAW is less lossy than JPEG usually .Compression primer 

I could go on for 50 pages about compression (and did in my school work) but here there are only a few things you need to know. JPEG compression uses a very clever algorithm to “throw away” part of the image that your eye doesn’t notice. This is based on some fancy math that I’ll describe in a future article, do a search on Google for discrete cosine transform if you’re the curious type. The key thing about JPEG that is important in this debate is that JPEG throws away a variable amount of data, from a huge amount leading to the horrible jagged lines that show up in small picture files, down to no data at all. That’s right JPEG can be completely loss-less. Due to it’s clever math an image can be compressed about 5 to 20 times the original size without losing any quality. 

Unfortunately many camera default to a high amount of lossy JPEG compression in their settings. This is usually controllable somewhat via a “fine”, “normal”, or “basic” JPEG quality setting. In the D200 Nikon has improved this further by letting you choose an “image size” or “image quality” priority in the custom settings. The image quality priority on a JPEG fine image is loss-less to my eyes, and they are fine tuned to pic out compression artifacts. (In fact I can’t watch direcTV or any digital cable because the artifacts of the compression drive me crazy). So the argument that RAW gives you less compression artifacts is certainly true if you are shooting in JPEG basic quality, it becomes less true to non-existant as you move up the quality tree. 

Raw 
RAW format is different for every camera, that’s why when a new camera comes out it takes a while for companies such as Adobe to come out with camera raw plugins. The RAW data is just that, raw data off the actual sensor that took the image. This data has no white balance, color correction or space, sharpening, or other in camera effect applied to it. This means that before you can do anything with your raw picture you have to open in a program that can read raw, such as Nikon Caputre, Adobe Camera Raw (Part of photoshop), Apple’s Apperture or iPhoto, or many others. Then you must set your white balance and other settings and then save it as another format. Often JPEG,TIFF or PSD. 

That sounds like a lot of extra hassle! What’s the gain? 
The main gain is that there has been no white balance applied to the photo. Current cameras are good but not great at auto white-balance. I’ve had plenty of shots from my Nikon cameras come out with the wrong tinge due to this. There are also some gains in image dynamic range. The RAW files have 12 bits per pixel of information, this gives you a slight improvement in the ability to make out highlights that may be blown out in a JPEG; however, Nikon compresses RAW files with a lossy format as well, so you may lose this gain unless you turn off raw compression in your menu. (this is not even an option on the lower end D70 and D50 cameras) 

So it’s JPEG then? 
As a professional photographer I shoot in JPEG fine with image quality priority 99.5% of the time on a client shoot. The only .5% of the time I use RAW is for images that I know have a large dynamic range. With the D70 I used to shoot RAW also when there was a shot I knew I was going to blowup above 16×20 just to give that little extra bit of data, but I’m not sure I ever needed it. With the D200 and it’s image size priority I can’t imagine ever shooting in raw again in the near term. The extra time it takes to process raw files in the work flow is not worth the ability to save a shot with poor white balance, when I’m on a job I ensure this is correct before I start shooting anyway. As a rule I’d rather be behind the lens than behind a monitor. 

Bottom line : Raw can give you a very slight edge on the highlights in poorly exposed photos, and possibly a slight quality edge in older model cameras that don’t offer a high quality JPEG setting; however in new high end dSLRs I think the high quality JPEG setting is your friend. Make sure your white balance is good and shoot away, knowing that you save a step in post processing and you can fit a good number more shots on your memory card.