[ad_1]
Image compression reduces file size while maintaining quality. Lossy compression sacrifices quality for significant size reduction, while lossless compression maintains quality. Methods include reducing color space and run-length encoding. JPEG is a popular variable compression method with minor quality loss.
Image compression attempts to reduce the file size of digital images while maintaining image quality. This is achieved by applying data compression methods to files. The file size of an image can be reduced with or without a loss of image quality; these are called lossy compression and lossless compression, respectively. Image compression is useful when a computer user wants to minimize the required storage space or maximize the data transfer rates of an image.
The first type of image compression is lossy compression. A user looking to drastically reduce the size of an image file may opt for a lossy compression method if a reduction in image quality is worth a significant reduction in file size. Digital camera images and videos are examples of digital files commonly compressed using lossy methods. A user will not be able to restore the original image because there will be compression artifacts or irreversible alterations in the image.
A simple method for lossy image compression is to reduce the color space to a smaller set of colors. Color spaces can range from just eight distinct colors to millions of colors. The larger the color space, the more data is required to specify a particular color. Converting an image to grayscale, or shades of gray, is a similar lossy image compression technique.
Lossless image compression is a method of reducing the file size of an image without sacrificing image information: you can always recover an image that is identical to the original. Lossless forms of data compression are needed when the reductions in quality are deemed unacceptable. Medical imaging, engineering drawings, and astronomical observations typically use lossless compression techniques.
One method of lossless image compression is called run-length encoding. Simple images often have many repeating pixels or small dots of color. For example, in an image with a black background, the entire top row of pixels might be black. The run-length encoding method stores this string of black pixels in two values: one for the color and one for the number of pixels in the string. This method can store the same amount of information with much less data.
A Joint Photographic Experts Group (JPEG) is an example of an image compression method with a variable compression level. JPEG compression typically leaves behind a certain amount of compression artifacts, but can reduce file sizes by more than 10x with only minor loss of quality. Some JPEGs will load an image with progressively more detail, allowing the user to see a preview of the image as it loads. These aspects of the JPEG image format have made it very popular on the World Wide Web.