There are a myriad of image file formats. Some common and some unheard of. So which is the best format for everyday use? What are the differences and how ideally should one work with these file formats? The choices for the file format are simpler than you might think.
First the basics! For simple people like us, there are just a few determining factors behind each of the file formats.
The data from sensor
Sensor is composed of millions of individual pixels. Each pixel is either red, green or blue. To replicate our eye’s sensitivity, there are twice the number of green pixels than red or blue. These pixels capture the information from the image that falls on them. This design was proposed by Bryce Bayer and so it is called Bayer filter.
Processing of sensor information
The information captured on sensor can be stored without any alteration along with some information from the camera settings or the information can be further processed in the camera itself. The first step that happens is the application of demosaicing. Simply put, it just smears each pixel on the adjoining pixels to get a more natural looking result. After this the camera settings are applied to the captured data and the image saved.
Lossy vs. Lossless compression
A lossless compression algorithm discards no information, while reducing the size of the image file. In contrast, lossy algorithms accept some degradation in the image in order to achieve smaller file sizes.
Number of colors (bit-depth)
Images start with differing numbers of colors in them. The simplest images may contain only two colors, such as white and black (or absence of white), and will need only 1 bit to represent each pixel. This is the smallest possible information content that can be held for each pixel. A bit-depth of 2 indicates just 4 shades/tints of a color. Bit-depth of 8 gives 256 values to a color.
Larger file sizes take up more space. They are slower to open and work with on computers.
(Nikon D200 with Nikkor 50mm, f/8, 1/90 sec at ISO 100. Image saved as raw and then post-processed to 8 bit jpg)
Now comes the interesting part, the files types used in photography! A basic understanding of the file formats will make the workflow easier while retaining the quality. It is actually quite simple.
Raw file format
This is nicknamed as the digital negative. There are various raw file formats in use. Unfortunately everyone who is anyone in the manufacturing of photography equipment or computers has tried to bring out their own version of standardized format and so we are now flooded with choices. There are hundreds of raw formats presently in use. Raw file format is the direct data from a digital camera sensor that has not been demosaiced (not yet reconstructed to a full photograph by any image editing programs), meaning that a raw file is only composed of either a red, green, or blue value at each pixel location.
First advice to all photographers is to start clicking raw. Raw file formats are a way of storing the data captured from camera sensors directly. Each camera company has its own way of producing and naming raw file. Nikon calls them ‘nef’ or ‘nrw’. Canon has ‘crw’ or ‘cr2’. Adobe has tried standardizing everything into a ‘dng’ but failed. A lot of manufacturers also encrypt their raw format. Regardless of how the raw file is produced, the companies try to preserve the exact data captured from the sensors and also accommodate some of the other vital information.
Usual raw files consist of –
- The data from the sensor (the image).
- A small file header which typically contains an identifier, an indicator of the data ordering of the file and an offset into the main data.
- Camera sensor metadata which is required to interpret the sensor image data. This is what is different with most formats.
- Image metadata. These may include the exposure settings, camera and lens model, date, location at times and sometimes information about method used for focusing, metering and even flash. Most raw files contain a standardized metadata section in Exif format.
- An image thumbnail or/and a small image in JPEG format, which can be used for a quick preview
- A file name.
- Copyright information which is frequently a part of image metadata.
When a camera saves a raw file it defers most of the work (demosaicing) to post-processing stage. Typically the only processing performed is the removal of defective pixels before saving the raw file. Sometimes noise reduction is also applied by some manufacturers before saving the raw file. This raw data format therefore has many advantages. Any errors in settings of exposure, color temperature balance, sharpening, saturation and even color space can be corrected in post-processing without any harm to the image.
TIFF (Tagged Image File Format)
This is a very flexible file format when it comes to usage. For more than two decades there have been no major changes in the format. Graphics artists use it very often. Some of the raw file formats themselves are based on it. Compression is also generally not used and the ‘saves’ do not result in loss of any information. Usually in photography workflow, the tiff files are generated from raw files after the basic exposure settings, color temperature, sharpening etc have been applied to it. The resulting files are large in size due to no compression. My recommendation is to save all raw files as tiff for archiving purposes and for any editing you might want to do in future. Raw formats are not standardized but tiff is and it is now under the control of Adobe.
Default formats for saving work (PSD, AFPHOTO etc.)
All the image editing programs have a native file format which works best for them. These store information about all the intermediate steps, history and even store the file in such a manner that it is easy for the program to read. The drawback – non standard file types with huge file sizes. These file formats are native to their parent image-editing program and most suited to working with them. Use these file formats only for saving your work if you have to urgently leave your photo-editing session midway. Saving the work midway in these formats will ensure that you will be able to start from the exact point where you left. However after completing your post-processing/editing, use the other, more common file formats for saving the final work.
JPEG/JPG (Joint Photographic Experts Group)
If you are viewing a photograph on website, there are very high chances that it is a jpg. It is one of the commonest format in use presently. Jpg uses compression which is unfortunately lossy. With each consecutive ‘save’, there is some loss of information.
Jpg has its own advantages –
- All the camera settings and changes in the post-processing are embedded into the image and so the viewer sees the images as the photographer intended to.
- The file size is small. Easy to share, easy to use online.
- Compatible with almost all image editing programs. I do not recommend playing around with it though.
BMP (Bitmap Image)
This is an image format that was popularized by Microsoft. It stores information of each and every pixel along with the applied camera settings. These can not be changed as in raw. The sizes of these files are large so photographers generally do not prefer bmp. Though not technically correct, I consider bmp as the old grandfather of tiff.
GIF has a limitation in colors it can handle. PNG is a good format but not well supported. I therefore suggest not to think of these two formats while working on photographs.
(The image on the left is a usual 8 bit-depth jpg. The image on the right is a 4 bit-depth image. Notice the loss of color gradient on the wall in the background. In the pair of images shown below, the image on the right is a regular 8 bit-depth jpg but saved with high compression)
Managing file formats –
All the file formats have their advantages and disadvantages. I have formed a method which I use for my digital darkroom. If you are convinced by my reasoning, please feel free to incorporate it in your own workflow.
- Click all images in raw (I use Nikon’s nef with no compression)
- Copy the raw files to hard disc
- After post-processing the images, save them as tiff and also as raw. Saving as raw generally edits the supporting information in the file itself without touching the main data. Now a days, the edited information is saved in a separate small file, commonly called as a ‘sidecar’.
- Save another copy as jpg at 100% quality setting with smoothing applied.
- For internet use, I resize the jpg images and save them separately.
- I do not believe in converting raw files to a dng or any other common raw format.
The best way out is to use a combination of the file formats in daily work flow –
- For archiving, store raw files with their sidecar files and also a second copy as tiff. I click few photos and storage space is easily available so for me saving both raw and tiff is not a problem. For those of you who are bothered with storage space, either save raw only and also keep a backup copy of the software that you use for post-processing your images, or convert all to tiff and save them after doing the necessary corrections.
- Tiff images are used for printing the images (in CMYK).
- Full size jpg files with 100% quality for online printing when I happen to use this service and for uploading to photo sharing sites.
- My backups are incremental in nature and include both raw and tiff files. As far as jpg are concerned, they can be created anytime from tiff files by batch converting them using any of the freely available programs.
Apart from the above, there are few more things to keep in mind.
- Work on the highest bit size or bit depth available in your camera and supported by your image editing software. Bit depth is the number of bits used to represent each color in a pixel. Higher numbers represent more precise colour expression. Higher bit depth also ensures more endurance to changes in post-processing without spoiling the image. The changes are subtle after a certain bit-depth but still it is better to play safe and use high bit depths.
- If you are working on an image and want to take a break, save the image in the software’s proprietary format. This will preserve all the work done including the history of changes and various layers.
- Use a color-space which is replicable across all your devices. RGB is the safest bet but now AdobeRGB is also gaining some standing.
- Use no compression. Keep the quality at 100% while saving as jpg. When saving as jpg, keep it as the last step in your workflow.
Follow the sequence of the steps as outlined here – Post Processing RAW