Image formats (RAW, JPEG, HEIF) and compression

Find out about different file formats – RAW, C-RAW, HEIF and JPEG – and different types of image compression.
Most digital cameras enable you to choose between different image formats (also called file types) to save your pictures in – RAW, JPEG and now HEIF (introduced with the EOS-1D X Mark III in 2020). What are the differences between these formats, and which should you choose?

RAW files

A RAW file is what the name suggests: raw, unprocessed data. It contains the image data exactly as captured on your camera sensor. Any white balance, Picture Style or other settings that you might have applied are only appended to the image file. This means they can be changed later using RAW processing software such as Canon's Digital Photo Professional (DPP) or Adobe® Photoshop® (with up-to-date Adobe Camera Raw plug-in), among others.

A RAW file is often referred to as "digital negative" because the data can be processed and printed in different ways to produce different results, just like the negative from a film camera. Also like a film negative, the RAW file never changes. When you open a RAW file in a software application, process and edit it and then save it, this creates a new file on your computer (usually your choice of a JPEG or TIFF). The original RAW file is unchanged, and can be opened again at any time and worked on to produce a completely different result.

The letters RAW do not stand for anything – it's just a convention that RAW is usually written in capital letters – and the names of RAW files from Canon cameras do not end in .RAW. Instead, until the DIGIC 8 processor was introduced with the EOS M50, Canon cameras saved RAW files in the .CR2 format. Some cameras also offered the option of smaller, lower-resolution "medium" (M-RAW) and "small" (S-RAW) files. These two types of files have most of the advantages of a RAW file but because they are lower resolution they take up less storage space.

The DIGIC 8 processor enabled a .CR3 file format, with a C-RAW option that captures the same resolution but produces 35–55% smaller files, saving storage space on your memory card. (To do this, however, C-RAW uses lossy compression – that is, it discards some image information. More about this shortly.)

The RAW files from different camera models are not exactly the same, even if they are the same file format (CR2 or CR3). For this reason, RAW processing software such as DPP is regularly updated to support new camera models, so if you have a new camera, do check for updates to DPP and download the latest version.

A number of EOS cameras give you the option of processing RAW images in-camera, which is great if you want JPEGs to share and prefer to customise settings such as white balance, brightness and noise reduction yourself rather than just using your camera's built-in JPEG settings. Processing RAW files on your computer instead of in-camera, though, gives you the advantages of a larger screen and greater processing power.

Advantages of RAW

  • Maximum editing flexibility
  • Wide range of settings can be modified after capture
  • 14-bit file – records widest range of colours and tones

Disadvantages of RAW
  • Larger file size
  • Needs processing (usually on a computer)
A view of a valley with green hills and fluffy clouds in the sky above.

An appealing landscape shot – but this is a JPEG file, which means it has been processed in-camera, discarding most of the colour and tonal information that was initially captured.

A view of a valley with green hills and fluffy clouds in the sky, with more detail and richer colours.

The same shot saved as a HEIF file contains more colour and tonal detail – four times more, in fact. The difference between these two images is not a matter of exposure or contrast settings – there is simply more information and therefore more image detail in the HEIF version, most notably in areas such as the sky and clouds.

JPEG files

JPEG stands for Joint Photographic Experts Group, the body that initially defined the JPEG standard. All JPEGs are the same universal standard format, whatever their size and quality.

If you set your camera to save your shots as JPEGs, the camera processes the image information it has captured and saves a compressed file. It can be saved at different image sizes (Large, Medium or Small) and quality settings (levels of compression) to give different file sizes – selecting Large and Fine Quality produces the best quality JPEGs, while using Small and Normal produces the smallest files, so you can fit more shots on your memory card. However, even if you choose highest quality JPEG, the camera actually discards most of the data it initially captured.

When it processes the image, the camera also applies the camera parameters, Picture Style and other settings. Once the JPEG has been saved, these settings cannot be changed – they are "baked in". You can of course open a JPEG in your image editing software and adjust colour, exposure and so on, but JPEGs are 8-bit files – that is, there is less information there than in the 10-bit, 12-bit or 14-bit files offered by EOS digital cameras – which means you have less editing headroom. More about this shortly.

This may not be a problem if you are making relatively minor edits and printing at sizes up to A4, but it might be significant if you want to make larger changes or bigger prints. Also, a JPEG file is recompressed each time it is edited and saved, meaning it can lose some data each time.

Advantages of JPEG
  • Smaller file sizes – more images can be stored on a memory card
  • Universal format – no special software is needed to read them
  • Images are easy to view, share and print

Disadvantages of JPEG
  • 8-bit – reduced colour depth and resolution
  • Reduced post-processing flexibility
  • Lower quality settings can result in degradation of image quality, artifacts, etc
A brightly-lit display of manga characters, with rich yellow, orange and red colours against a night sky.

Another example of the difference between JPEG and HEIF images. If you got this JPEG straight from your camera, you'd be quite satisfied that it captured the bright colours of this display.

A brightly-lit display of manga characters, with richer colours and more detail producing a more three-dimensional appearance.

By comparison, however, a HEIF contains perceptibly more colour detail, capturing much greater subtlety in areas of colour gradation where the JPEG contains relatively flat colours.

HEIF files

HEIF stands for High Efficiency Image File Format. It's a format introduced with the EOS-1D X Mark III in 2020 and also available in the EOS R5 and EOS R6, released in the same year. The format can be used to contain data for several different types of media, including images. As in a JPEG, the effects of camera settings such as white balance and Picture Style are "baked in", but Canon HEIF files are 10-bit, meaning they contain four times more colour and tonal information than JPEGs, which are 8-bit. As well as giving you more headroom for editing, this makes HEIF images a good option for high-res images you want to view on an HDR-standard monitor, such as a 4K reference display. (More about bit-depth shortly.)

Despite containing four times the colour data, HEIF files are typically about the same size as JPEGs, because HEIF compression is 50% more effective than JPEG (hence the "high efficiency" part of their name). The compression algorithms are also more modern than those used in JPEGs, which should prevent the artifacts and colour banding common in highly-compressed JPEGs.

Advantages of HEIF
  • 10-bit – more tonal and colour information than JPEG
  • More post-processing and editing flexibility
  • Small file sizes despite containing much more information than JPEG, and less image degradation

Disadvantages of HEIF
  • No perceptible difference from good quality JPEG on most monitors
  • Printer support not yet universal – photo printing kiosks, for example
A dark shot of a sunrise over a city, the buildings barely visible.

When you photograph a sunrise, the image you get from your camera might look something like this.

The same shot of the sunrise over a city lightened, with prominent banding in the sky.

If it's saved as a JPEG and you then lighten it in your image editing software, you might see more detail but also risk introducing banding, visible in the sky here, where the image does not contain enough tonal detail to show smooth gradations of colour.

A small area of the previous image enlarged showing different degrees of banding.

These enlarged details compare the degree of banding in 8-bit, 10-bit and 12-bit versions of the same part of the lightened image.

A graphical representation of a spectrum: 8-bit with obvious stepping between colours, 10-bit with less obvious stepping, and 14-bit with a smooth gradient.

A graphical representation of the difference that bit-depth makes. An 8-bit file (such as a JPEG) can contain much less colour information than a 10-bit file (such as a HEIF file), and a 14-bit file (such as a RAW file) contains even more. This means that, although you won't necessarily see obvious stepping between colours in a spectrum in JPEGs, gradations of colour and tone are much smoother in files with greater bit-depth.

Bit depth

Bit depth is literally a measure of how many bits (ones and zeroes) are allocated to store the data in a digital file. So an 8-bit file can contain up to 256 (28) levels of information for each colour channel (red, green and blue). This means that each pixel in an 8-bit JPEG can have any of up to 16.8 million (256x256x256) colours.

HEIF files are 10-bit files, which means they can contain up to 1,024 shades per colour channel, giving a potential 1.07 billion colours.

RAW files are 14-bit files, which gives them the potential for up to 16,385 tones per channel, or up to 4 trillion colours.

Clearly, higher bit depths are better because of the greater number of possible colours, which means that the file can record finer variations in tone, subtler transitions in colour and smoother gradients, but often it's not possible to discern the difference, especially when viewing images on an ordinary monitor. The real benefit comes when you edit files with subtle gradations. Files with greater bit depth can withstand more adjustment without unwanted colour shifts or banding being introduced.
A low-quality JPEG of the tail of an aircraft, showing flaws such as banding and artifacting, compared to a higher-quality version of the same image.

Left: a heavily-compressed JPEG (low quality setting), or one that has been repeatedly resaved, will exhibit flaws such as blockiness, banding and artifacting (the random areas of colour in the sky), and typically starts to look fuzzy or pixelated. Right: a higher-quality JPEG does not exhibit such flaws, although the sky in this example is already less smoothly graduated than the ideal.

Compression – to compress or not to compress?

Other things being equal, files with higher bit depths are larger than those with lower bit depths, and require more storage space. That's not true in the case of HEIF files, though, which are typically no larger than JPEGs even though they are 10-bit files and JPEGs are 8-bit. That's because of differences in image compression.

The most widely used type of image compression is JPEG. In simple terms, the compression algorithm looks for areas in the image where pixels have similar colour and brightness. It records the full data for the first pixel and then writes the digital equivalent of "same" for matching adjacent pixels. This takes up less space than recording full details for every pixel. When the image file is opened for viewing, the algorithm uses the data from the first pixel to re-create the additional pixels.

Different degrees of JPEG compression are possible. At maximum compression levels, the file size can be as little as 1/100th of the size of the original file. However, as the level of compression increases, the algorithm starts to batch pixels that are less close in colour and brightness. When the file is opened again, the re-created pixels are less close to their original brightness and colour values. This leads to loss of detail and tonal range, banding in areas that should have smooth gradients of tones or colours, and compression artifacts (mottling or blockiness).

It is important to realise that once a file is compressed using this kind of compression, some of the image data is lost and cannot be recovered. As with resolution settings, you should never use a compression level that takes the file below the quality you need in the final image.

Also, data is lost every time a modified file is compressed. If you open a JPEG file, make changes and then re-save it as a JPEG, additional data will disappear.

HEIF files use a more modern and sophisticated form of compression than JPEG, which results in less of this kind of image degradation.
A diagram showing an image being compressed using lossy compression, with some image information being discarded, resulting in banding instead of a smooth gradation of colours.

Lossy compression algorithms produce smaller files but do so by discarding some image information when they save the file. This means that when you view the image again, some detail is irretrievably lost, resulting in less detail, flatter colours and often banding where there should be a smooth gradation of tones.

A diagram showing an image being compressed using lossless compression. The compressed file is not as small, but the image retains all the colour and tonal detail it originally had.

By contrast, lossless compression algorithms reduce the file size without discarding image information. This means they cannot produce files as small as those produced by lossy algorithms, but no colour or tonal detail has been lost when you view the image again.

Lossless and lossy compression

File compression algorithms that discard some of the original image data are called "lossy". However, "lossless" compression is also available. This kind of compression uses mathematical algorithms to encode the image information and pack all the data into less space. This is fully reversible, so that when the file is opened, all the data is still there. This means that there is no reduction in image quality.

Lossless compression is used by Canon digital cameras when the highest resolution image is stored as a RAW file, except when C-RAW is selected.

Lossless compression cannot achieve the file size reductions offered by lossy compression methods such as JPEG or HEIF compression, but standard Canon RAW format files can often be saved at a quarter of the size of an uncompressed file (the actual file size is affected by the subject and the ISO setting). If you select the C-RAW option, some lossy compression is applied so that C-RAW files are smaller than standard CR3 files.

File sizes

While using the highest resolution settings with the lowest compression settings produces the highest quality images, they are also the largest files, which not only fill up storage space but also take longer to save, because data can be saved to storage media at a specific speed according to the media type. Sometimes it may be more important to fit more files on your memory card or to enable the camera to save shots more quickly when shooting continuously. For this reason, Canon cameras offer a number of image size and compression options.

The table below shows the impact of the various settings available on the EOS R5.
A table showing file sizes, number of possible shots and maximum burst for continuous shooting at different file type and quality settings on EOS R5.

The EOS R5 manual gives an indication of the different file sizes produced at different file type and quality settings. The numbers shown here are indicative only and will vary depending on several factors including the capacity of your memory card, ISO speed, Picture Style and Custom Function.

A diagram comparing lossy compression, which discards image data, with lossless compression, which does not.

Another graphical representation of the difference between lossy and lossless compression. Lossy compression (top) discards image information to save space, but this information cannot be restored, so image detail is irretrievably lost. Lossless compression (bottom) uses different methods to reduce file size, so that no detail is lost when you view the image again.

Which is best?

There is no simple answer to this. It depends on several factors, and what you need at one time may not be suitable in other circumstances. But here are a few pointers to help you decide.

If you want the maximum image quality, shoot at maximum resolution with low JPEG/HEIF compression (best quality, large files), or preferably in RAW format. However, this not only takes up more memory card space, but also reduces the number of shots you can take in a burst before your camera's buffer fills up, and it increases the time it takes to transfer the images later. This won't always matter, but is important if you want to shoot rapid sequences at sports events or share images with others quickly.

Also, if you plan to do a lot of post-capture processing or need to produce very large (poster-size or even larger) prints, then it’s usually best to capture the highest quality RAW files with the least compression, to give you the most image data to work with.

On the other hand, if you want rapid access to your images, shooting compressed JPEG files allows you to read the files directly from the memory card. Don't assume that JPEG means poor image quality. Unless you select the lowest quality, you are in effect just letting the camera do the processing for you, carrying out a preset RAW conversion using optimised standard settings. The results will be fine for on-screen viewing or prints up to A4 size or so.

If you want JPEGs to share quickly but also the option to edit your shots later with maximum flexibility, and speed and memory card space are not an issue, don't overlook the option of RAW+JPEG, which saves each image in both formats simultaneously.

If your camera offers the option of HEIF, give it a try. It promises the best of both worlds, and is now being supported in most editing software.

The best way to find what works for you is to shoot the same subject in different file formats, at different combinations of resolution and compression, and take a look at the images on a computer screen. You should also print images from the smallest and largest files and see what differences, if any, you can discern. You might be surprised to discover that reducing resolution can have less perceptible effect than you imagine.
* 1-5. File size, number of possible shots, and maximum burst vary depending on shooting conditions (including 1.6x crop/aspect ratio, subject, memory card brand, ISO speed, Picture Style, and Custom Function). Please check the EOS R5 Advanced User Guide for more details.

Written by Angela Nicholson

Related articles

Related products

Get the newsletter

Click here to get inspiring stories and exciting news from Canon Europe Pro