JPEG Compression
Why it's bad - Why we need it
|
Ever try to resize an image and make it just a little bit smaller and all of a sudden it becomes a grainy, blocky mess? Anyone who does anything with photos on a computer has experienced JPEG compression at its worst.
JPEGJPEGs are one of the most common file formats that exist. Since its introduction JPEG has become a staple for image compression. JPEG is a "lossy" image compression format which means that when a JPEG image is compressed some of the data is permanently lost. If you shrink the file to a small size larger display sizes will look fuzzy. However because jpeg compression is such a highly refined compression algorithm higher resolution images can be stored without taking up an overwhelming amount of storage space.Many digital cameras shoot directly into JPEG format. Cameras often have "Quality" settings which dictate how much compression should be applied to the file before being stored to the memory card. Lower quality will be slightly compressed - losing a certain amount of pixel data - but data space will be drastically conserved - resulting in the ability to shoot many more photos.
JPEG CompressionA bitmap image file comprises information about pixels. The pixels are laid out in grid pattern with information about color and brightness encoded into each pixel on the grid. When the image is rendered on a monitor each pixel is displayed on the same grid and together they form an image.JPEG compression reduces the file size of a bitmap image through a complex process of algorithmic changes to the grid of pixels. The image is broken into 8x8 image segments. These image segments are analyzed by the process responsible for compression and simplified. The compressing algorithm looks for patterns or regularities in color and brightness values within the image segments. This simplification process can be very effective in reducing file size. Image quality suffers at higher levels of compression. Because the algorithm is looking for patterns in color or brightness levels certain types of images are more suited towards JPEG compression. Specifically, images which have steady gradients or large areas of color can be compressed very heavily without excessive loss of quality. Images that have lots of lines, borders or text do not always compress as well. Image QualityImage quality may be reduced as a byproduct of compressing JPEG images. This loss of quality is due to the occurrence of what are known as "artifacts" - remnants from an earlier compression version. These artifacts often look like fuzzy boxes and often occur in areas where there is an edge in the image, especially at the transition between two different colors.The following chart is designed to help you understand how image compression actually affects the output of the image. I took a series of 80x80px BMP images and converted them to JPEG images with quality settings of 100, 50, 25 and 0. Large blocks of color - such as the all black images - change very little. In the other images minor artifacts become visible at around Quality=50. Images are displayed at 200% for clarity.
File SizeBecause compressed files store less total image data they take up much less space on a hard drive. Reducing file size is the primary objective of JPEG compression. Smaller files are easier to store and easier transmit. To clarify this point further I did another test sample. I cropped a small (200x165) portion of a larger photograph and then saved it in decreasing quality. It should be noted that the "Quality" rating is based on the JPEG export settings from GiMP and should be recognized as being a relative scale with Quality=100 being the original crop slice. I had already scaled the image once before this experiment began but I don't believe that changed things because its all relative to the Quality=100 sample. It is interesting to notice how drastically the file size drops between Q=100 and Q=75 without any appreciable drop in quality.
|









