Tuesday, May 24, 2011

RAW vs JPEG, Myth or Fact? The Definitive Guide

Too much orange color? Hit the jump to know what's going on
Today I am going to wet my feet and discuss a much debated topic, RAW vs JPEG. This topic causes almost as much debate as the Canon vs Nikon does amongst fanboys, but this post is not about concluding which one is the best, but rather the strengths and weaknesses of each format and when to use either of them.

This post is intended for beginners and experienced photographers equally, I will compare both formats in 5 categories: white balance, highlight recovery, shadow recovery, noise and sharpness.

Hit the jump for the real showdown.

WHAT IS A RAW FILE?

I first learned about RAW when I was researching my first semi-pro camera, the Canon G11, I saw people very enthusiastic about the camera shooting RAW, and I was thinking what's the big deal? Why would RAW be any better than JPEG? Aren't both files an output from the same camera, thus should be the same?

Definition: RAW is basically the information the camera sensor collects when you take a picture, it is recorded into a file and that is your RAW file.

The RAW file as is doesn't represent a picture as we know it, and can't be viewed until it is processed, you might think that what you see on your camera's screen is the RAW file, but it is not, what you see is a processed (or converted if you like) RAW file. So what does this processing actually do to your RAW file? 

RAW PROCESSING

What any camera does after grabbing the RAW data from sensor is process it in a picture that we can see, even if your camera doesn't give you the option to record RAW files to the memory card, it still uses it internally and applies it's own processing to that file to give you your JPEG files.

This processing includes many parameters, the RAW file doesn't contain the white balance information, so the camera takes that file and corrects the white balance first based on the white balance setting you made (even if it's auto), then it will apply some image parameters like: sharpening, noise reduction, contrast, saturation, highlight recovery, lens distortion & vignetting correction, etc...

Then after all of this image processing, it will bake the resulting image in a JPEG file, compress it and throw away all the extra data recorded from the RAW, and this is the file you get at the end of the day. If you are shooting RAW only on your camera, the same process happens to give you the image that you see on the back screen but without recording a JPEG file to your card.

Most of the image parameters and JPEG compression settings are available for you to set in your camera, in Canon the picture parameters are called "Picture Styles", and you also have different compression settings as for the JPEGs. Each camera manufacturer has different settings available for the user to set and they usually have their own secret algorithm for processing the image; like the lens distortion correction and the noise reduction algorithms.

WHY WOULD I SHOOT JPEG?

For several reasons, the triggering idea to this article was when I went to an autocross event (as a spectator with a camera) and I was asked by a friend to cover some parts of the event since no photographers were hired for the event, I started by shooting in RAW as I usually do but when I discovered that I will be taking a huge amount of pictures and that I will have to post-process all of them I decided to switch to JPEG since the job wasn't really critical and JPEG in itself would produce good enough results without needing any post work.

So here we see the first advantage of JPEG, no post processing required, you can of course post process your JPEGs and add a touch of enhancements, but for me, this is against the point of shooting JPEG in the first place.

What's more, switching from RAW to JPEG gave me a longer burst rate, my 60D can capture up to 16 continuous RAW files in a burst before the buffer fills up and the camera slows down. In JPEG mode, even if I'm shooting with the least compression (i.e. biggest file sizes), I can keep firing pictures until the memory card fills up, if I was shooting RAW I wouldn't have been able to get this 26 frames burst of one of the cars crashing.

Click to see a much larger picture (the last frame is mis-placed, my mistake)

Another advantage of shooting JPEGs is the file size, on my 60D (also the 550D, 600D & 7D) the average RAW file size is 26 megabytes, while the highest quality JPEG average size is less than 6 megabytes, you can do the math quickly and see that one RAW file is as large as 4 or 5 JPEG files. In the same autocross shoot I took around 1400 pictures in 3 hours, and I only filled up half of my 16GB card.

So to summarize the benefits of the JPEG:
  • Smaller file size
  • Longer burst rate
  • Usually no extra post processing needed
  • You can immediately give the JPEGs to your friends (they hate waiting for me to return home and process the images)

RAW FILE ADVANTAGES

Now it's time to see what advantages does a RAW file have over a JPEG file, if you have read all of the above, you should know by now that when the camera creates the JPEG file and compresses it, it throws away a lot of data, in the coming part I will show you how important this data might be.

For testing purposes, I used my Canon 60D along with my sharpest lens, the 60mm f/2.8 Macro. I set the camera to shoot RAW + JPEG (L), this way when I take each picture I get both the RAW and JPEG files. My picture style was the standard one but with the saturation and sharpness both increased one notch and the contrast decreased by two notches.

Test 1: White Balance

The main advantage (from my point of view) of the RAW file is that the white balance isn't baked into the image, you can freely adjust it in post just as if you changed the WB on the camera and re-took the picture. I shot the original picture under tungsten light but my camera WB was set to Flash, this resulted in this orange-y picture.

My daughter's color book, shot under tungsten light, WB set to flash (~ 5600 K)

Then I put both the RAW and JPEG files in lightroom and used the WB dropper and clicked the white page in the book to get the correct white balance.

RAW - WB corrected in lightroom

JPEG - WB corrected in lightroom

You can clearly see that correcting white balance on a JPEG file will not give you accurate colors, but what about human skin?

Original - taken with a wrong WB setting

RAW - Corrected WB, this is how his skin looks like in real life

JPEG - Corrected WB, maybe I could get rid of the pink tint?

JPEG - Corrected WB, I attempted to remove the ugly pink tint, but the colors are still wrong

This is a clear win for the RAW file, you might argue that good photographers will never make the mistake of choosing the wrong white balance, and you might be correct, but keep in mind a few things:
  • Pro photographers can forget to adjust the white balance in changing light, sure they will discover it the first time they see the screen, but they might have missed the moment, we are all humans and prone to error.
  • Sometimes you'd be shooting in changing light temperatures like a sunny sky that keeps changing to overcast several times while during a shoot, or an indoors party with changing lights, in these situations I use Auto WB and make the necessary adjustments in post.
  • Even though the 60D is known to have a very good Auto WB, under tungsten light it picked the above book picture at 3200 K temperature while the correct WB was 2400 K, even the tungsten preset on my camera will set the WB to 3200K.
  • Finally, sometimes you would want to give a bit of warmth to a picture or to someone's skin color, this can be done easily by changing the WB.

Test 2: Sharpness & Details


I noticed this one after I returned from the autocross shoot, I looked at some of the portraits that I took at 100% magnification, and I found them not as sharp as I am used to from my lens, at first I thought it was because of a focusing error, then I discovered that the JPEGs were the culprit, mind that I am using the standard Canon style with the sharpness increased by one tick, so it should be pretty sharp without any extra artifacts or noise appearing.

And to make that test harder for the RAW file, I was shooting at ISO 400 with ZERO sharpness applied in lightroom, and the noise reduction luminance slider was only at 10. Look at three areas, the middle of the eyebrow, the bottom eyelashes, and the skin pores to the left of the eyebrows.

RAW, ZERO sharpness applied
JPEG, Canon's standard picture style with sharpness increased by one notch

No contest really, too much data is thrown away, of course you can sharpen the JPEG in post, but you can do the same to the RAW file, don't forget that no sharpness is applied to this RAW file.

Below is another quick example of the difference in details between both file types, the below picture was taken at ISO 3200, I suspect that the noise reduction at this high ISO is the culprit behind the detail loss, more so than the JPEG compression algorithm.

Original Picture, ISO 3200, room lighting, hand held

RAW - 100% Crop

JPEG - 100% Crop

Test 3: Highlight Recovery

When I was editing the picture for this test, I noticed that the RAW file for the image below was 34 megabytes in size, a frickin' 8 more megabytes than normal RAW file, if anything, this indicates how much data the RAW files keep inside, eve if you won't see it.

I took this picture through a glass window with the exposure compensation set to over-expose this image by 3 stops, that's 8 times more light than it should have, this situation happens to many of us where something goes wrong like hitting the exposure compensation dial by mistake (or forgetting that it was previously set at something else). Maybe you overexposed the image by using too much flash power as a mistake, etc...

Original Picture, over exposed by 3 stops

You can see here that we have a very bad situation, in attempting to fix the image, I pulled the recovery slider all the way to the right, decreased the overall exposure by two stops and added some contrast using the blacks slider. I tried doing the same for the JPEG but it didn't work, so I tried other different things like the saturation and the curves but failed to fix it.

RAW fixed

JPEG fixed, but still looking messy

Test 4: Shadows Recovery

This test will show us the effect of attempting to recover the shadows if you have shot an underexposed image or want to add fill light to a dark area of an image, of course this test is taken to the extreme, but I wanted to see how much latitude did the JPEG file have versus the RAW file.

Original Image, severely underexposed

The image you see above is underexposed by lots of stops (can't remember how many), it's almost one and a half stops away of being completely black. I will attempt two methods of recovering the shadows, in this first one I will try to recover the whole image by pulling the exposure slider all the way to the right (+4 stops).

RAW, exposure +4

JPEG, exposure +4

I have to say that the JPEG file didn't do bad here, but the RAW file reveals more details and colors, which you can see in the 100% crops below:

RAW, 100% Crop

JPEG, 100% Crop

For this second example I shot a lens in a dark room against a bright background and exposed for the background, this resulted in the lens being completely dark, I attempted the fix by pulling the fill slider all the way to the right, both results weren't pretty but the JPEG sucked more. I didn't use any noise reduction in the RAW image.

Original Picture, exposed for background

RAW, fill slider all the way to the right, there is noticeable noise but good detail

JPEG, really ugly blotches and severe loss of detail


Test 5: Noise

Noise in my opinion is one of the things where Canon's JPEG engine fails to deliver, in high ISOs you can notice too much color noise and strange color blotches. If you don't already know, Canon ships it's own "Digital Photo Professional (DPP)" with any camera that supports RAW, this is their own RAW converter, and it uses the same algorithm the camera uses to convert to JPEG, so if my picture style in the 60D was Vivid for example, I can choose the same picture style in Canon's DPP and I will get the same picture as if it came out from the camera, I really hate how it handles noise and sharpness settings.

On the other side, Adobe's latest ACR (found in Photoshop CS5 or Lightroom 3) handles both the noise and sharpness aspects really really well, I once tried taking an ISO 12,800 image through different famous noise reduction programs and was able to get the best result with the least amount of settings and time from LR3. What ticks me off is how Adobe can process Canon's color noise better than Canon themselves?

Anyway for this test I used the same card reader I used in the details test, the image is shot at ISO 3200 (which is my mental limit by the way, check this post), I will show you first the RAW image without any noise reduction, then the JPEG, then the RAW again with noise reduction applied.

RAW, 100% Crop, zero NR

JPEG, 100% crop, standard NR in camera

RAW, 100% crop, NR applied in lightroom

CONCLUSION:

As you can see from the results, the RAW files are superior in almost every aspect to the JPEG files, except for the size and the need for post processing. They also take a huge space on your hard drive when you have thousands of images. By now you're probably wondering which format to use, but before you do, please read these conclusions:
  • If you're satisfied with the images from your camera as is, you probably shouldn't switch to RAW, I usually advise my friends with new DSLRs to shoot in JPEG, that's what they are used to, they mainly bought the DSLR for the shallow DoF and the responsiveness, not to be able to count someone's eyelashes.
  • If you don't have time for post processing hundreds of images after each shoot, then stick to JPEG and try to find the correct picture style settings that will give you the best images you like.
  • If you only post your images on the web or print them on small sizes, it makes no sense to shoot in RAW, some of my friends set their cameras to 5 megapixels since this is all they need.
  • Learning to process RAW files might seem daunting at first (it was to me, I was never able to make my RAW images even as good as the JPEGs, let alone better), but after watching this one hour long video by Zack Arias describing in extreme detail his digital workflow, I felt like everything finally fell into place and started making sense, then I downloaded the LR3 trial and was the happiest man on earth, I really recommend this video to anyone getting into RAW post processing.
I shoot RAW myself because I love getting the most details, the least noise and the sharpest pictures I can, and this is why I buy better lenses, the only problems I face are the storage space on my computer (not the memory cards, they are cheap and I have LOTS of them) and the post processing time.

Here's how I solved the space issue, after a shoot I copy and review all of the RAW files on my desktop PC, I immediately delete any picture I don't like or think that I will never use, it makes no sense to have several images for the same situation, only the best images remain, I choose the best one from each situation, process it then save it as a resized JPEG (usually 2000 ~ 2500 pixels on the wide side), these JPEGs are the ones that I keep and show to people, the RAW files remain on my desktop and 95% of the time I never come back to them. So each while I just backup the old ones to an external HDD or a DVD or whatever, and I probably wouldn't need them again (remember that I am no commercial photographer, just an advanced hobbyist).

As for the post processing issue, I have reached a stage where my lightroom preset is configured to give me  good images from the get go when I import the pictures, I only have to edit some individual ones and maybe tweak the exposure and the white balance in some. One more thing I learned from Zack Arias' video is to be consistent when I am shooting so that I can easily copy the changes I made to one picture to the others quickly.

The final reason that I shoot RAW for is that when I'm combining ambient light with bounce flash and gelling the flash, things might get a little bit out of control (especially when bouncing to colored walls), so I love being able to easily adjust the WB without affecting the picture quality. See my DIY Gels post here for examples on combining different light sources.

I hope that this article has helped you with any doubts you had about RAW vs JPEG. If you have any questions or ideas that you want me to test please fire it in the comments.

10 comments:

  1. Thank you for this post. It is very clear and easy to follow. I've bookmarked it so I can refer others to it.

    David D. Nelson

    PS. I found it from your post on Neil vN's site.

    ReplyDelete
  2. Thanks for your feedback, glad I posted it on Neil's post.

    ReplyDelete
  3. There's no arguing against such clear explanation with great sample images! Well done. I know how much time it took to compile all this. Great job.

    ReplyDelete
  4. Very well written....very clear explanation! Thank you.

    ReplyDelete
  5. Good comparisons, but (in my view) mistaken conclusions. You're right that most people shouldn't worry about the extra quality; it's the latitude for error correction that makes RAW absolutely worthwhile. Especially for new photographers!

    ReplyDelete
  6. You spent a lot of time on this. Unfortunately, I took your first example - white balance picture of man's face - saved the image in jpeg - did a quick white balance - and got an image as good or better than your RAW processed example. Not sure what SW program you are using for post?

    Also looked at the next example of sharpening. I always shoot in jpeg. I do lots of close portrait shots. I don't have the most expensive camera with the the coolest lens. I get tack sharp images a majority of the time. When the image is off, it is me, not the "loss" of data using jpeg.

    Just so you know, I make no in camera enhancements except to set the correct white balance for the setting of the picture I am taking. I also make some exposure adjustments.

    Conclusion - Learning curve is steeper for RAW than JPEG. 99 % of the time there is no difference. Only time RAW is beneficial is when you have overexposed the shot by 2-3 stops.

    There is no magic to RAW. Many beginners read RAW, RAW, RAW and think the reason their photos are not coming out as great is they would like is because they need to learn RAW. Not true.






    ReplyDelete
    Replies
    1. Well, you just about summed up what I exactly said in my conclusion, we both agree that RAW isn't practical for everyone, especially beginners.

      Regarding the white balance, you have a good point, the JPEG image of the man was corrected for white balance in Lightroom 3 and what you see above is what I got, however I tried doing the same again with Lightroom 4.3 and it corrected the white balance much better and almost similar to the RAW file, so it seems Adobe engineers have done some good work.

      But, I tried the book picture and it didn't correct it as it should, so it doesn't work everywhere, I have several examples where I wasn't able to correct the white balance in JPEGs.

      Delete
  7. Thanks. This is still proving useful a couple years on. Even with Lightroom 5.4 I can't make my jpegs looks as good as RAW files, there is just more information for Lightroom to play around with. My XZ-2, has excellent jpegs to start of with though I now tend to use RAW for those difficult light situations and jpegs for everything else.

    ReplyDelete

Thanks for your comment. It will be published as soon as we get a chance to review it, sorry for that, but we get lots of spam with malicious links.