If you plan on sharing photos of your family or business with others, you will naturally want to share only the best images. However, if your images contain a lot of pixels and you want to share them by sending them through email or via upload to the web, the file can be too large resulting in slow uploading speeds. The JPEG standard for image compression has been around since about 1992, and has since become a popular method for compressing digital photos. Before JPEG was created, people used a different method to compress their pictures but this resulted in pixelation of the pictures when they were re-opened after compression.
The JPEG (Joint Photographic Experts Group) format is the standard meant to encode images and photographs in a digital camera or image processing software. The JFIF (JPEG File Interchange Format) file format is most commonly used, especially in Internet environments. A JPEG image consists of several components, including a header with metadata, a marker stating the color mode and number of colors, an optional color profile that determines how the data should be interpreted by comparing it to an embedded color profile, and finally the actual pixel data as well as any metadata that relates to these pixels.
JPEG is one of the most popular image formats that also happens to be one of the best ways to compress photographic images. JPEG utilizes a lossy compression format, which means that it can only reduce the file size of an image. But it’s been fine-tuned for compressing photographs, so for that type of media it works very well.
Jpeg Standard For Image Compression
JPEG is an image compression standard which was developed by “Joint Photographic Experts Group”. In 1992, it was accepted as an international standard. JPEG is a lossy image compression method. JPEG compression uses the DCT (Discrete Cosine Transform) method for coding transformation. It allows a tradeoff between storage size and the degree of compression can be adjusted.
Following are the steps of JPEG Image Compression-
Step 1: The input image is divided into a small block which is having 8×8 dimensions. This dimension is sum up to 64 units. Each unit of the image is called pixel.
Step 2: JPEG uses [Y,Cb,Cr] model instead of using the [R,G,B] model. So in the 2nd step, RGB is converted into YCbCr.
Step 3: After the conversion of colors, it is forwarded to DCT. DCT uses a cosine function and does not use complex numbers. It converts information?s which are in a block of pixels from the spatial domain to the frequency domain.
Step 4: Humans are unable to see important aspects of the image because they are having high frequencies. The matrix after DCT conversion can only preserve values at the lowest frequency that to in certain point. Quantization is used to reduce the number of bits per sample.
There are two types of Quantization:
- Uniform Quantization
- Non-Uniform Quantization
Step 5: The zigzag scan is used to map the 8×8 matrix to a 1×64 vector. Zigzag scanning is used to group low-frequency coefficients to the top level of the vector and the high coefficient to the bottom. To remove the large number of zero in the quantized matrix, the zigzag matrix is used.
Step 6: Next step is vectoring, the different pulse code modulation (DPCM) is applied to the DC component. DC components are large and vary but they are usually close to the previous value. DPCM encodes the difference between the current block and the previous block.
Step 7: In this step, Run Length Encoding (RLE) is applied to AC components. This is done because AC components have a lot of zeros in it. It encodes in pair of (skip, value) in which skip is non zero value and value is the actual coded value of the non zero components.
Step 8: In this step, DC components are coded into Huffman.