JPEG, TIFF and RAW
The size of the digital file corresponding to the image which the camera produces depends on the pixel count. In most consumer digicams each pixel generates 3 bytes of data (so called "8-bit data"). One for red, one for green and one for blue. This means that a 3MP camera, which has 3 million pixels, generates 9 million bytes of data, or 9MB (megabytes). A few cameras can generate extra data for extra quality, and some of these cameras generate files which correspond to 2 bytes of data for each color ("16-bit"), so a 3MP camera which is capable of generating 16-bit data will produce an 18MB image file.
Now these files are pretty big and they can be compressed quite a lot without a significant drop in quality. This is where JPEG (Joint Photo Experts Group) comes in. JPEG is an algorithm designed to work with continuous tone photographic images) which takes image data and compresses it in a lossy manner (this means you do lose some information). The more you compress, the smaller the file but the more information you lose. However, you can reduce file size by a factor of 10 or so and still get a very high quality image, just about as good as the uncompressed image for most purposes. You can reduce the file size by a factor of 40 - or even more - but the image starts to look really bad!
On the left, 10:1 JPEG compression. On the Right 40:1 compression.
Uncompressed the image would look virtually identical to the 10:1 JPEG on the left.
With 10:1 compression the 8-bit files generated by a 3MP camera would be 900Kbytes in size rather than 9Mbytes, which is a big saving with little quality loss. The smaller files take up much less storage space and are much faster to send between computers or from the digital camera or memory card to a computer.
There are also lossless ways of saving files using TIFF (Tagged Image File Format) . These keep all the original information, but at the cost of much bigger files. TIFF files can be compressed in a non-lossy way, but they don't get very much smaller. For example, compare the file sizes for the rabbit image above: TIFF files can also be used to save 16-bit data (those these files are twice the size of 8-bit data files), JPEG files can only save 8-bit data.
| Uncompressed TIFF | Compressed TIFF | JPEG at 10:1 compression | JPEG at 40:1 compression |
| 176.1 Kbytes | 157.6 Kbytes | 17.4 Kbytes | 4.5 Kbytes |
Some cameras offer a third option, that of saving the actual data generated by the sensor in a proprietary format. Canon calls their version of this "RAW", Nikon call it "NEF". These files are compressed, but in a non-lossy manner. They are significantly smaller than equivalent TIFF files, but larger than JPEGs. Typically they achieve a compression of around 6:1 using 16-bit data, so files are 1/6 the size of equivalent TIFF files. The only disadvantage of these formats is that the image must be converted to either JPEG or TIFF for most software to be able to display them. The conversion is quite a complex process and can be time consuming if you have a lot of images to convert and a PC that's not very fast. Since the RAW and NEF formats contain more information than JPEGs (and in fact often more than TIFF files) you can do some degree of exposure compensation during conversion to JPEG to rescue otherwise improperly exposed images. You can also make white balance corrections during conversion, so if you shot with the wrong white balance, you can fix your error.
Credit by photo.net