Pages

Tuesday, July 8, 2014

J is for JPEG


J is for JPEG


The term "JPEG" is an acronym for the Joint Photographic Experts Group, which is the name of the committee that created the JPEG standard. A JPEG is a commonly used method of lossy compression for digital images like those taken with a digital camera. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality.

Lossy Vs. Lossless

Low Compression | Medium Compression | High Compression

          JPEG's are typically used as a lossy compression method, the class of data encoding methods that uses inexact approximations for representing the content that has been encoded, which somewhat reduces the  image fidelity. A lossy form of compression is used based on the discrete cosine transform. This mathematical operation converts each frame/field of the image source from the spatial domain into the frequency domain.

          JPEG can be used as a lossless compression method, a class of data compression algorithms that allows the original data to be perfectly reconstructed from the compressed data, as well. A number of alterations to a JPEG image can be preformed losslessly as long as the image is a multiple of 1 MCU (Minimum Coded Unit) block. Blocks can be rotated in 90 degree increments, flipped horizontal, vertical, and diagonal axes and moved about in the image.


         There is also an interlaced "Progressive JPEG" format, in which data is compressed in multiple passes of progressively higher detail. This is ideal for large images that will be displayed while downloading over a slow connection, allowing a reasonable preview after receiving only a portion of the data.

JPEG filename extensions

The most common filename extensions for files employing JPEG compression are .jpg and .jpeg, though .jpe, .jfif and .jif are also used. It is also possible for JPEG data to be embedded in other file types - TIFF encoded files often embed a JPEG image as a thumbnail of the main image, and MP3 files can contain a JPEG of cover art in the ID3v2 tag.

Common JPEG markers

Start of Image = SOI
Start of Frame = SOF0 (baseline DCT)
Start of Frame = SOF2 (progressive DCT)
Define Huffman Table(s) = DHT
Define Quantization Table(s) = DQT
Define Restart Interval = DRI
Start of Scan = SOS
Restart = RSTn
Application specific = APPn
Comment = COM
End of Image = EOI