JPEG Format & Compression

How does the JPEG compression?

jpeg compressionThe image data are almost always redundant, ie, they contain repeating patterns, which can be summarized for lossless compression: from the second occurrence of the same pixel sequence is sufficient to refer to the first occurrence, which requires much less storage space. The best-known compression method of this type is developed by Lempel, Ziv and Welch (LZW), as, for example, programs such as WinZip and StuffIt on the PC! is based on the Macintosh. GIF images are always LZW compressed TIFF and a format with a vast number of variations can also be the compression of image data according to LZW. This lossless methods are very effective when it comes to compressing images with flat, sharply defined structures, but typical photos can thus shrink only slightly. Large compression factors can be achieved only with lossy (“lossy”) procedures to save the image data not only compact, but to further reduce memory consumption omit data whose absence does not make a significant difference for the image impression. A lossy image compression sacrifices a portion of the original image quality in order to save disk space, and because many image details are invisible to the human observer, be ignored or viewed as unimportant, you can reduce the file size quite dramatically before the quality is clearly visible deteriorated.

JPEG

For more than a decade, which is developed by the “Joint Photographic Experts Group,” named after this body JPEG method the dominant lossy compression method. The JPEG file format is JFIF beside the GIF graphics format widely used on the Internet, as well as Adobe’s PDF format and Apple’s PICT support the compression of image data according to the JPEG method. Since version 6.0, Photoshop can even save TIFF images JPEG compressed when. Even at the cost of incompatibility with other image editing programs For digital cameras, JPEG / JFIF is next to the TIFF standard graphics format.

jpeg compressionDespite the many advantages of JPEG, which are responsible for the universal success of this compression method, it also brings with it some inherent disadvantages. Although one can image files often compress to one-tenth of their original size without loss of image quality noticeable, but at higher compression JPEG typical artifacts are visible: where to change the colors in small steps, dissolve the image into square blocks of color on, while showing high-contrast contours ghosting.

To understand these issues better, one must know how to work the JPEG compression.JPEG and for almost all the lossy compression techniques, is that in a first step, the colored pixels fit makes for the subsequent compression. The starting point of the JPEG compression are the pixels in the primary colors red, green and blue, which are for a lossy compression is not optimally suited. Before the actual compression simply convert the RGB colors, for example, in the YCrCb model that the first channel stores the pure brightness information (Y), so the average of the brightness of the red, blue and green channel. Stores in the second channel is the deviation of the red channel of the average brightness, and in the third channel, the deviation of the blue channel. The value for the green channel can be calculated from this and does not need to be specially recorded.Once you have separated as components luminance (brightness) and chrominance (color), you can reduce the resolution of the two chrominance channels to half or a quarter, as they for the sharpness does not matter. The visual cortex of humans contains independent systems for the perception of colors and shapes, and the color-blind would ignore Formerkenner fine resolution color boundaries anyway, the color detection system works again with a three to four times as low resolution as the form of recognition. When storing the images from digital cameras is the fact that the individual pixels of a CCD chip register respectively the red, blue or green component of light, but not all three. Each missing color components must be interpolated from the neighboring pixels, which is why the color resolution is lower than the brightness and anyway, the loss in this first, chroma subsampling said compression step is limited. The conversion of colors into a luminance / chrominance color model and the coarsening of the color resolution is neither limited to the way the JPEG method yet to digital technology, the analog color television standards PAL, SECAM and NTSC provide very similar transformations.

For the actual JPEG compression divides the image into one of 8 times 8 pixel blocks, which are processed independently. Using the mathematical method of the discrete cosine transform (DCT), a relation of the known Fourier transform is determined from the variations in brightness within a block the frequencies contained therein (the method is, in the mathematical sense, “discrete”, in that it, with individual pixels Thus samples of continuous brightness profile works). The results are 64 coefficients, which contain almost the same information as the original 64 pixels. The coefficients of the individual frequencies is now shares each case by a number which is greater, the lower the significance of the frequency component is to human perception, and the smaller the compressed image file is to be at the end, and rounds off the result to an integer In extreme cases, the result is zero and can be omitted entirely, but the effect of data reduction is only achieved when the last step, the coefficients of all the 8-by-8-blocks are in a so-called entropy encoding converted space as possible in zeros and ones. An entropy coding are known from Morse that the most common letters in English “e” the shortest code assigns the rare letter “q” on the other hand, the longer sequence. “” “-. -”.Similarly, we coded frequent (usually small) coefficients with shorter bit strings as the rarer.

Annoying artifacts

 

jpeg compression artifacts

About Considering the compression setting the JPEG method, so almost all the coefficients reduce to zero, and the 8-by-8-fields are reduced to unstructured blocks of color that make such a picture for most applications unusable (see right). Another problem lies in the method of discrete cosine transform to replicate the brightness profiles by an addition of individual vibrations tries. While periodic oscillations with this method can be played well, it’s time for changes, such as an abrupt change from light to dark adapted poorly. After the DCT approach is still passable, but if due to a high compression factor only a few coefficients are left, the resulting vibration can appear ghosting and halos.

To avoid such artifacts, one should choose as far as possible the highest JPEG quality level that can be set on the camera, this will compress the image consistently to one-fifth to one-tenth of the original file size. If you can adjust the degree of resharpening, one should choose the lowest level, as highlighted by the re-sharpening artifacts enststandene by subsequent JPEG compression still. The most inevitable sharpening better left an image editing program which allows a control of the effect, generally sharpening should always be at the end of the image processing.

CAPA is for Carrier and Postmus Architects