Image Formats – RAW vs JPEG

This subject can be quite straight forward to understand if you are either quite technically minded, or you understand some of the metaphors I’m going to use to explain it.

Here’s a metaphor:

Film_stripRAW is to JPEG, as Exposed Film is to Photographic Print

Well sort of, and if you have no idea how film photography works, then this won’t make any sense at all. Some say it’s like Film Negatives, but I actually think the metaphor is best placed somewhere between the actual film and the first development (the negative).

I’ll explain in simple terms quickly: When you take a photograph on film, the light that hits the film is “recorded” within the light-sensitive chemicals of the film, but you can’t just take the film out of the camera and take a look at it, the film has to be developed, usually into a film negative and then printed to photographic paper, often done by projecting it onto the paper and then applying more chemical processes to the paper to bring out the image.

So the film, once you’ve taken photographs, is the “raw” image data. It is the recording of exactly what the camera saw, without any manipulation. Then, while developing and producing prints, this raw information is manipulated, adjusted, projected, and chemically developed to achieve the final output.

JPEG

I’m going to start back-to front on this one. I’ve seen others lunge into what a RAW file is first, and I think it’s actually easier to grasp the other way around. Generally most people who’ve done some form of digital photography, or maybe even taken a photo on their phone, will know what a JPEG file is. The filename often ends with .JPG and nearly every device you own that has a screen, will be able to view it. Most phones, and point-and-shoot cameras take photographs straight to JPEG.

Film_stripzoom

Click to zoom in and see the effects of compression on the quality of the image

Without going into too much detail of how a JPEG works, the basic concept is that the file contains information about blocks of colour. JPEG uses the concept of Compression, which means that if areas of the image are the same colour, it only needs to hold information about the area as a whole, rather than information about the colour of each individual pixel. The more compression applied to an image, the more it treats similar colours as “the same”. In other words, the more compression, the less detailed, and more blocky the image will start to look, but importantly, the smaller the file-size.

That last bit about file size is one of the important things to remember. Even the highest quality (least amount of compression) image will be significantly smaller in file-size than a RAW file, and that’s the main advantage of sharing images in JPEG format (along with the fact that everyone has a device that can view them).

RAW

So why is a RAW file so much bigger in file size. Let’s give you an idea of the difference:

  • An 8 Megapixel JPEG with a medium amount of compression will be about 1 Megabyte in file size
  • An 8 Megapixel RAW will be 8 Megabytes in size

JPEG file sizes depend on the size of the image (Megapixels), the amount of compression applied, and the amount of detail in the image; if you’ve taken a photo of a small white dot in the corner of a black image, the file size will be significantly less than a photo of a flower bed containing multi colored flowers of varying shapes and sizes.

RAW file sizes are constant; pretty much around 1 Megabyte per Megapixel regardless of what the photograph is of and how detailed or colourful it is.

There is no such thing as compression in the RAW world; every single pixel is accounted for and its colour is stored in the file data. If there’s 2 pixels next to each other with the same colour, this doesn’t decrease the file size, both pixels are treated as separate pieces of information.

But there’s a lot more to it than that. The way in which each pixel is represented is different, it’s not as simple as saying the colour, it might be easier to think of it as the “level and tone of the light that hit that pixel” which is why we call it RAW, it’s the low-level raw information about what the camera saw. Along with this pixel-by-pixel dump of data from the sensor of the camera, the file also contains some other things:

  • Information about the Camera
  • Information about the Settings used on the Camera
  • Information about the Lens
  • A small JPEG thumbnail of the image taken
  • A larger JPEG preview of the image taken

These (while unfortunately helping to increase the file size even more) are required to help aid development of the RAW data into a usable image during processing. Well, the last 2 are actually there to help you quickly browse through the images on your device without having to do any conversion.

What does all of this mean?

Let’s go through a few examples:

wbExample 1: White Balance

Let’s take a really simple example of White Balance. When you’re indoors next to a white-blueish light, you either manually set the camera’s white balance to Fluorescent mode, or you let the camera try and work it out in Auto White Balance (AWB) mode. What you’re trying to avoid is all of your whites coming out blue, and in fact the whole image being cast a general color of blue. Setting the white balance to Fluorescent tells the camera to change its colour temperature to something to counter this general blue cast of light it’s going to receive when you take the photograph.

If you’re shooting in JPEG and you now take the photograph, the resulting JPEG image will have your chosen white balance applied to it. If you made the wrong choice, tough… your colours in the image are your colours now. You can try and fiddle with them in Photoshop if you want, but ultimately you’re not going to escape the mistake you made.

If you’re shooting RAW though, the resulting image will have 2 parts: the RAW light data, with no colour balance applied to it, and the camera settings data recorded elsewhere that indicates what white balance you’d chosen at the time. When you then open up the image in something like Lightroom or Photoshop (using the Camera RAW add-on), the software combines these 2 bits of information to show you on your screen an image with your chosen white balance. At this point, if you chose the wrong white balance at the time of shooting, you can now select a different white balance / colour temperature, within your editing software… and as if by magic, the image will change, looking exactly as if you’d taken the photograph with the right setting in the first place.

exExample 2: Exposure

Of course, rule #1 is: always expose your images correctly. But if you don’t, and you’re shooting in JPEG, you’re in trouble. You can try and play with the levels and try and edit your way out of your mistake, but ultimately unless the mistake was only slight, you’re not going to come back from it.

In RAW however, due to the depth of data recorded for each pixel, you have a lot more room for error. Once you’re in your editing software, you can slide the Exposure up and down and see for yourself just how much data is hiding behind either your blown-out highlights, or your underexposed shadows. It’s not perfect, you can’t take a black image and find a brightly lit scene hiding in there somewhere, but it certainly is powerful for significantly badly exposed images.

hishaExample 3: Dynamic Range

This pretty much follows on from Exposure and the depth of data that’s recorded. With a JPEG, what you see is what you get (WYSIWYG), if your image looks great except the contrasting shadows are too dark and you want to bring out the detail in them, you’re going to hit the limitations of JPEG pretty quickly when you use something like the Shadows and Highlights image adjustment tool in Photoshop. If you’ve got a lot of compression on the image, it’ll be even worse, you’ll just start turning your black shadows into large blocks of grey and purples, there’ll be no detail hiding in the darkness for you to bring out.

With RAW images though, there’s a good chance there’s something in there for you to get at. Dynamic Range pretty much means the range of light levels across the image from the darkest parts, to the lightest parts. Digital camera sensors can usually see quite a nice range of light levels, and this really does depend on the sensor quality though, but all of this range isn’t “kept” in a JPEG output, however it is in the RAW image data. When you first fire up the RAW file in your editor, it will show you the image using typical settings, i.e. it will look similar to as if you’d taken it as a JPEG, but very quickly you can change that. You can increase the shadows slider and start to see the dark parts of your image brighten, and detail lost in shadows will start to appear. Similarly you can start to reduce the Highlights slider, and start to see the brightest parts of your image start to reduce in brightness, for example revealing additional cloud detail in a brightly exposed sky.

As with everything, this isn’t limitless, and depends on the capabilities of your camera’s sensor and the ISO settings, etc. that you took the image with, but it really does start to expand what you’re able to do with your images.

Myths

There’s some strange things people will tell you about RAW vs JPEG. Even when quickly researching what others had said online about this subject, I was shocked to see some pretty reputable sites and authors saying things that just aren’t true. It shows a total misunderstanding of what RAW is when someone says these sort of things:

faceRAW images are not as sharp as JPEG images

This is a real face-palm thing for me to read. If you take a photograph in both JPEG and RAW and when you view the images, your JPEG looks “sharper” then this will be because you had Sharpness turn on/up on your camera when taking the JPEG. The camera then applies this to the final outputted JPEG image. In most cases this is probably what you want, a nice crisp image, but as is the general theme of this article, what about if you realise you’ve set it too high and the image looks “over-sharp”… well, you’ve had it, you can’t go back from there.. WYSIWYG remember!

Your perception of the RAW image not being as sharp as the JPEG is in fact the wrong way round. The RAW image is as the camera sensor saw it, the JPEG has simply had additional sharpness added to it during processing. Your editing software will have a Sharpness slider in it when looking at the RAW image, and you can simply increase this if you don’t think the image looks sharp enough. Generally speaking your software will be aware of what setting you had chosen on the camera for sharpness anyway and will try to recreate this in the preview of your RAW image. Of course, the benefit there is, if you had the sharpness turned up too high, you can just turn it down at this stage, and no damage has been done.

RAW images are dull and washed out compared to JPEG images

Wow, I’ve read this on 2 separate articles of the same title as mine today. This is a truly shocking statement to make.

If you’re looking at your RAW image in an editor and it seems a bit dull… adjust the settings and get it looking more vibrant. Chances are there’s even a “Vibrance” slider to help you do this!

A JPEG image is pretty much the same thing, applied already by the camera at the time you took the photograph. It takes your chosen Sharpness, Contrast, Saturation and Colour Tone settings and produces a JPEG from the RAW data on-the-fly. And yes, just like I’ve said before, with this outputted JPEG file, WYSIWYG, you can try and desaturate your image after the fact, and decrease the contrast if your blacks are too black, but you’ll never fully be able to play around with the image settings like you can with a RAW… with every JPEG taken, a significant amount of raw image data is lost.

Summary

It’s quite simple, if you don’t edit your photos and you have very small memory cards, then go ahead and shoot in JPEG.

If however you do edit your photos, you like to manipulate them, and you have plenty of space, then shoot in RAW. Once you’ve edited your RAW images in your software of choice, you can then output your manipulations to JPEG to share with everyone. You can make them look as vibrant and as sharp as you want!

Comments

comments