|
JPEG 图像压缩 FAQ, part 1
Section - [4] How well does JPEG compress images?
Very well indeed, when working with its intended type of image (photographs and suchlike). For full-
color images, the uncompressed data is normally 24 bits/pixel. The best known lossless compression
methods can compress such data about 2:1 on average. JPEG can typically achieve 10:1 to 20:1
compression without visible loss, bringing the effective storage requirement down to 1 to 2 bits/pixel.
30:1 to 50:1 compression is possible with small to moderate defects, while for very-low-quality
purposes such as previews or archive indexes, 100:1 compression is quite feasible. An image compressed
100:1 with JPEG takes up the same space as a full-color one-tenth-scale thumbnail image, yet it retains
much more detail than such a thumbnail.
For comparison, a GIF version of the same image would start out by sacrificing most of the color
information to reduce the image to 256 colors (8 bits/pixel). This provides 3:1 compression. GIF has
additional "LZW" compression built in, but LZW doesn't work very well on typical photographic data;
at most you may get 5:1 compression overall, and it's not at all uncommon for LZW to be a net loss (i.e.,
less than 3:1 overall compression). LZW *does* work well on simpler images such as line drawings,
which is why GIF handles that sort of image so well. When a JPEG file is made from full-color
photographic data, using a quality setting just high enough to prevent visible loss, the JPEG will
typically be a factor of four or five smaller than a GIF file made from the same data.
Gray-scale images do not compress by such large factors. Because the human eye is much more
sensitive to brightness variations than to hue variations, JPEG can compress hue data more heavily
than brightness (gray-scale) data. A gray-scale JPEG file is generally only about 10%-25% smaller
than a full-color JPEG file of similar visual quality. But the uncompressed gray-scale data is only 8
bits/pixel, or one-third the size of the color data, so the calculated compression ratio is much lower.
The threshold of visible loss is often around 5:1 compression for gray-scale images.
The exact threshold at which errors become visible depends on your viewing conditions. The smaller
an individual pixel, the harder it is to see an error; so errors are more visible on a computer screen (at
70 or so dots/inch) than on a high-quality color printout (300 or more dots/inch). Thus a higher-
resolution image can tolerate more compression ... which is fortunate considering it's much bigger to
start with. The compression ratios quoted above are typical for screen viewing. Also note that the
threshold of visible error varies considerably across images. |
|