An Introduction to Photo File Formats

Every two weeks, we revisit some of our reader favorite posts from throughout the history of Phototuts+. This tutorial was first published in November of 2009.

Having a sound knowledge of file formats is essential for digital photography and image manipulation/editing. This article explores the different file formats involved in taking the photographs, their pro's and cons, as well correct use of file formats in a digital workflow. The last section concerns the best file formats for printing, the web, and sharing with friends & family.

Step 1: In-Camera Formats

When you take a photograph, the image is stored on your memory card. In order to fit more photos on the memory card, your camera compresses the photos. This process is known as encoding. Photos can be encoded in certain ways, and whether you're using a compact camera or a Digital SLR the photos are encoded in JPEG format by default. Many cameras can be set to encode your photos in a variety of ways, each with its distinct pros and cons.

In order to find out what variety of file formats your camera can encode, it's best to check your manual. Alternatively if you feel that consulting a manual is for the weak, fiddle with your camera until you stumble across what's on offer!

General camera types and the formats they can encode:

Point & Shoot (budget digital cameras under $200): Generally cheaper digital cameras can only take photos in JPEG format. Compact (digital compact cameras over$200):

If you own a compact camera, as well as JPEG you may be able to take photos in RAW format. Check your manual to make sure.

Digital Single Lens Reflex:
All Digital SLRs cameras can shoot in JPEG and RAW. Some can also use TIFF and RAW+JPEG.

Step 2: Format Pros and Cons

In this next section, we're going to look at the various pros and cons of using different formats.

JPEG (Joint Photographic Experts Group)

JPEG is great for general photographic use. Used by all digital cameras, JPEG is a lossy format, which means it sacrifices some quality to ensure minimal small file size.

Small file size: Fit more images on your memory card and transfer images to your computer faster.

Take photos faster! A smaller file size means the image is written to your memory card quicker, so you spend less time waiting and more time taking photos.

Some DSLR cameras can take photos in rapid succession, called a continuous buffer. Using JPEG the camera is able to take photos very quickly for a longer period of time in comparison to RAW.

JPEGs can be viewed on any computer without third party software.

When capturing an image in JPEG, the noise is softened and the image is generally sharpened.  Also the camera typically reduces the image depth from 12 to 8 bits. There's a loss of detail and quality.

Suggested use for JPEG format

JPEG is the best format for general photographic use, such as holidays and social events where you need to take photos quickly and don't want to be waiting for your camera to save larger files such as RAW and TIFF.

(Note: Many cameras have a choice between JPEG, JPEG fine, JPEG large. Typically, a JPEG fine/large photo is double the file size of a normal JPEG photo.  The difference in quality between JPEG large/fine and a normal JPEG is noticeable depending on the size of the print.

RAW

RAW files are uncompressed and unprocessed. RAW files must firstly be processed using third party software before they can be printed or edited. Popular software for processing RAW files is Adobe Photoshop, Adobe Lightroom and Aperture (Mac only).

The main advantage to shooting with RAW files is that the image processing is done on the computer. This means if you are about to take a photo but you don't know which white balance or exposure settings are best, you can simply take the photo and perfect these settings later on your computer.

Another advantage of RAW is that it is a lossless format. This means that the image does not lose any quality or information (unlike JPEG). As a result, RAW files are much larger than their JPEG counterparts, bringing me to...

Larger files means less images can fit on a memory card. RAW files are typically four times larger than the same image encoded into JPEG format.

RAW files take longer to save to the memory card, and the continuous buffer doesn't last as long as JPEG.

Processing multiple RAW photos can be tedious and time consuming.

A major flaw with RAW format is that there is no single RAW format. Every manufacturer has their own variation of RAW. This means it is possible that the RAW photos you take today may be incompatible with future software.

Suggested use for RAW

Whenever your image has to be of maximum quality, use RAW (e.g. commercial/freelance work or treasured family photos)

Whenever you can't decide what the best white balance and/or exposure settings to use (e.g. when taking photos of young children/pets who won't sit still, take the jolly photo and tweak the settings later!)

TIFF (Tagged Image File Format)

TIFF is included in most professional SLR's. In short TIFF (like RAW) is uncompressed. However when you take a photo using TIFF you have to choose the exposure and white balance before you take the photo. Think of it this way: TIFF is like an uncompressed JPEG.

Suggested use for TIFF

TIFF should be used when you need your image to be maximum quality, but you have the time to tweak the white balance and exposure settings before taking the photo.

RAW+JPEG

When you take a photo with RAW+JPEG (you guessed it) your camera makes two copies of the photo, one RAW and one JPEG. Using RAW+JPEG carries the combined advantages of both RAW and JPEG. The only problem is your memory card will fill up much faster and your camera may take a little while to write both images into the memory card.

Suggested use for RAW+JPEG

(Note: The main purpose of JPEG is small file size convenience. When you take a RAW+JPEG, it partially defeats this purpose because not only do you have a JPEG, you've got a big fat RAW image as well.)

My suggested use for RAW+JPEG is when you've got time to set up the white balance and exposure, yet accept that you're only human so you might make a mistake. Lucky when you take the photo it will save a RAW file as well so if the image turns out bad at least you've got the RAW file you can edit.

Okay, so now you've chosen what file format suits you, let's continue!

Step 3: File Formats & Workflows

Consider the following situation:

You've been asked to create a photo montage of the beach. You go to the beach, take all your photos in JPEG then go home. When you're at home you load all the files onto your computer. You edit each photo in Photoshop, tweaking the brightness/contrast and curves. You then save each image as a JPEG. You then combine all your edited images into Photoshop and create your montage. You then save the image as a JPEG to share with your friends. You realize the colors are too bright so you open up the JPEG, tweak, then resave.

What's wrong here?

As you now know, each time you take an image in JPEG format it loses quality. Let's say (hypothetically) that each time the image is saved in JPEG it loses 5% quality:

 Step: Quality Loss: Total Quality: Taking the photo in JPEG. 5% 95% Editing the photo and then saving as JPEG. 5% 90.25% Importing the JPEG, creating the montage then saving as JPEG. 5% 85.74% Tweak colors then resave as JPEG 5% 81.64%

As you can see, throughout the workflow the image keeps losing quality. 5% each time may not sound like much, but it all adds up. The best way to fix this problem is to use uncompressed files. Below is a suggested workflow (using Photoshop to edit images):

• Firstly, take your images in RAW or TIFF format.
• If you chose RAW format, process the image then save as a TIFF.
• Now open up your image editing software (in this case Photoshop) and edit the image.
• When you have finished editing, save as TIFF.
• Create a new Photoshop document, and create your masterpiece.
• Save the document as a .PSD (Photoshop only).
• Save final TIFF.

Congratulations! Your image still retains 100% quality! Now if you have to make a change, you can open up your Photoshop document .PSD and make a change, then resave as a TIFF.

Using this method, your file sizes are much bigger than JPEG. That shouldn't really be a problem as most people nowadays have fairly large hard drives. Note: Professionals never sacrifice quality for a small file size!

Now that you have your final image as a TIFF, you want to share it with the world! There are two ways to go about this:

Step 4: Optimisation for Print

So you've created your masterpiece, and now you want to print it. If you've followed the suggested workflow (listed in section 3) your image is still in TIFF format. TIFF is widely accepted as a standard printing file format, so you're in good hands.

Before we continue, I have a little observation. Look closely at your TV or computer screen (and I mean really close!)

You will see that your screen is made up of many RGB sub pixels - that is, red green and blue. As you may know, the colors red green and blue can be added together to create a vast number of individual colors:

Now this is great for viewing on computer screens, but when it comes to printing there is another solution: CMYK or Cyan, Magenta, Yellow and (K) Black. The reason we want to change our image from RGB to CMYK is that in the printing industry, CMYK is standard. To get the most accurate representation of what your image will look like when printed, you must change your image mode to CMYK. To do so (in Photoshop) click Image > Mode > CMYK then press OK (note that this will flatten your image, so make sure you have a copy saved in RGB if you want to modify later). Now you're ready to print!

Step 5: Optimisation for Web

This process is all about a healthy balance between quality and file size. Remember: Most people have a monitor between 17 and 24 inches in size, therefore the ideal image size for the internet is 800x600. This means people with a 17” monitor can see the whole image, without having to scroll left or right.

We need to keep the file size to a minimum, as people today are not willing to wait for large files to load. I should know - I live in Australia (land of the slow internet!). An ideal image size for 800x600 photos is less than 100kb. That means that the images retain most of their original quality, yet load in less than a second. As far as file formats are concerned, you can't beat JPEG.

Below I have two JPEG images of my favorite stapler. Image 1 is the original, and Image 2 is the optimized image. Keeping in mind the rule of thumb, 100kb for an 800x600 image, the images below should ideally be 50kb as they are half the size (400x300).

Image Two: Optimized JPEG 29Kb

As you can see both images look very similar, yet one will load four times faster than the other!

The steps for optimizing images in Photoshop are:

2. File > Save for web and devices
3. Set the preset to JPEG and tweak the quality until the image looks satisfactory

This process involves trial and error, as some photos will look good with a JPEG quality of 40 or less, others need to have a quality of 70 or 80 to look satisfactory.

I hope you've found the tutorial useful, and invite you to share any other tips and thoughts about image file formats in the comments!