(JPEG also provides lossless image storage, but the lossless version is not widely supported.) When not too great, the compression does not noticeably affect or detract from the image's quality, but JPEG files suffer generational degradation when repeatedly edited and saved. Applications can determine the degree of compression to apply, and the amount of compression affects the visual quality of the result. JPEG applies lossy compression to images, which can result in a significant reduction of the file size. Nearly every digital camera can save images in the JPEG/JFIF format, which supports eight-bit grayscale images and 24-bit color images (eight bits each for red, green, and blue). The JPEG/JFIF filename extension is JPG or JPEG. JPEG (Joint Photographic Experts Group) is a lossy compression method JPEG-compressed images are usually stored in the JFIF (JPEG File Interchange Format) file format. Most lossy compression algorithms allow for variable compression that trades image quality for file size.įurther information: Raster graphics JPEG/JFIF Often lossy compression is able to achieve smaller file sizes than lossless compression. Lossy compression algorithms preserve a representation of the original uncompressed image that may appear to be a perfect copy, but is not a perfect copy. Lossless compression should be used to avoid accumulating stages of re-compression when editing images.
Lossless compression generally, but not always, results in larger files than lossy compression. Lossless compression algorithms reduce file size while preserving a perfect copy of the original uncompressed image. There are two types of image file compression algorithms: lossless and lossy. With vector images the file size increases only with the addition of more vectors. images with large continuous regions like line art or animation sequences) may be losslessly compressed into a GIF or PNG format and result in a smaller file size than a lossy JPEG format.įor example, a 640 × 480 pixel image with 24-bit color would occupy almost a megabyte of space:Ħ40 × 480 × 24 = 7,372,800 bits = 921,600 bytes = 900 KiB For example, graphically simple images (i.e. This characteristic sometimes results in a smaller file size for some lossless formats than lossy formats. With some compression formats, images that are less complex may result in smaller compressed file sizes. Considering exactly the same compression, number of pixels, and color depth for two images, different graphical complexity of the original images may also result in very different file sizes after compression due to the nature of compression algorithms. Images with the same number of pixels and color depth can have very different compressed file size.
A compression algorithm stores either an exact representation or an approximation of the original image in a smaller number of bytes that can be expanded back to its uncompressed form with a corresponding decompression algorithm. Images can be compressed in various ways, however. The size of raster image files is positively correlated with the number of pixels in the image and the color depth (bits per pixel).