How does JPG compression technically work?

How does JPG compression technically work | How does the JPEG compression work?

How does JPG compression technically work: JPEG is actually the name of the entity behind the filename. There is a little history behind JPEG.

When was jpg created & who invented jpeg? The joint group of photographic experts created the standard and published the first draft of the JPEG standard in 1992.

Almost all digital cameras use a compression algorithm called “JPEGCompression”. How does this work?


The algorithm can be broken down into different steps. We only show the stages of compression, decompression works in reverse order. We show only the most common compression: 8-bit RGB lossy compression. “Lossy” means that compression will also reduce some of the image content (unlike lossless compression).

How does JPG compression technically work

JPEG compression works by identifying the “similar” color zones inside the image and actually converting them to the same color code.


Example: If you have a 24-bit color image, it means that every pixel of the image must be able to store the color value of 16 777 216 colors. This can take a lot of space, especially in images with different colors.


People cannot distinguish high strength changes, especially high intensity. We don’t really see the difference between 16,777,216 colors, this is what JPEG compresses take advantage of. JPEG algorithm scans the image, it tries to identify areas of the image that can be considered the same color by humans, JPEG compression results in an image with no more storage pixel information than the actual color used and “compressed”, JPEG converts 8×8 blocks of pixels into numbers representing these magnitude differences.


The algorithm can see that you can store the same image just by using the 16-bit color space instead of the 24-bit, so each pixel in the new image will now take up the space of the 16-bit code instead. because of the 24-bit code.


The compression ratio (0100) of JPEG compression controls the “sensitivity” of the analog algorithm.

How to Merge JPEG Photos?

Color Space Transform and Subsampling

Since monitors have three color components for each pixel, one red, one green, and one blue, they use the RGB color space. We will assume that we have an image in the RGB color space and we will save it as a JPEG image.


The human eye is more sensitive to brightness than to color. For this reason, JPEG allocates more space for luminance information than color information. But to do this, we must first separate these two components, called luminance and chroma.


JPEG uses the YCbCr color space. It consists of three components: luma (Y), blue difference chroma (Cb), and red chroma difference (Cr). The luma component represents brightness while the other two components (Cb and Cr) represent color information.

There are some other aspects of JPEG Compression, i.e Block-Processing & DCT, Quantization, Reorder, and variable-length encoding.

Conclusion: I think you got an idea of how jpeg compression works? The JPEG compression is a block-primarily based total compression. The statistics discount is finished with the aid of using the subsampling of the color statistics, the quantization of the DCT-coefficients, and the Huffman-Coding (reorder and coding). The consumer can manage the quantity of photograph exceptional loss because of the statistics discount with the aid of using setting (or selecting presets).

For a great compression, the subsampling may be skipped and the quantization matrix may be decided on that way, so the statistics loss is low. For excessive compression settings, the subsampling is grown to become on and the quantization matrix is chosen to pressure maximum coefficients to 0. In that case, the photograph receives really seen artifacts after decompression.

Leave a Comment