Digital photo files are at their core a collection of bits and bytes. A file format is a description of how these bits and bytes are ordered. Using standard file formats allows one device like a digital camera to save a file that can be later on processed by another device for example a personal computer running a digital photo viewer software. JPEG files are a format that allows the storage of digital photos in a compressed format. Such format saves storage space, allows for faster transmission of files over the Internet and also for faster performance when viewing photos.
JPEG stands for Joint Photographic Experts Group. The original JPEG file format goal was to allow for the compression and storage of high quality digital photos. The JPEG file format was successful and was widely used. It later became an official ISO standard. JPEG files are also known as JPG file named after their common three letter file extension. JPEG files are the de-facto standard for storing digital photos and are used by virtually all digital cameras and computer software.
JPEG files store digital photos in a compressed format. There are two types of compression algorithm: Lossy and lossless. Lossless compression means that when opening a compressed file the extracted data is exactly the same as the original. Lossless compression is used for example to compress large documents. Lossy compression on the other hand means that the extracted data is a bit different than the original. At first it seems that the loss of data typical to lossy compression algorithms is a problem. But for some data like digital photos such loss can be negligible. The advantage of lossy compression is much higher compression ratios.
Using lossless algorithms with digital photos is limited and provides very poor compression ratios. Lossy algorithms on the other hand provide very high compression ratio while the quality degradation due to data loss is minimal and in most cases not noticeable. JPEG files support both lossy and lossless compression algorithms but since lossless compression is inefficient for digital photos it is hardly used. In most cases JPEG files use lossy compression to efficiently compress digital photos.
An example can help to understand why high compression ratios are so important even on the expense of a slight quality degradation. Digital photos files are arrays of pixels. Each pixel has a value that represents its color and intensity and is usually 3 bytes long. A digital photo taken with an 8 mega pixels digital camera has 8,000,000 pixels and the corresponding image file size would be 8,000,000*3=24,000,000 or 24Mbytes. 24Mbytes is a very big file. Big files are hard to manipulate they take a long time to send by email, they occupy large storage space and they take longer to load. If JPEG was used to compress and save the same digital photo a typical result would be a file size of about 3Mbytes. The quality of the JPEG photo would be lower than the original but the difference would not be noticeable to the viewer.