当质量设置为100时 JPEG 是无损的吗?

我明白 JPEG 是一个有损数据压缩标准,而“质量”因素控制着压缩的程度,因此也控制着数据丢失的数量。

但是当质量数字设置为100时,得到的 jpeg 是无损的吗?

57483 次浏览

Jpeg is lossy regardless of the setting. At 100, you just get the LEAST loss possible.

It's easy enough to test. Whip up a simple .bmp, compress that to a q=100 jpeg, then re-extract back to a .bmp. Use Gimp/Photoshop to do a "difference" of the two bitmaps, and you'll see the lossiness - it'll be much less noticeable than on a q=50 or q=1 conversion, but still be present.

According to wikipedia, No.

jpeg 100 has a compression ratio of 2.6:1. The compression method is usually lossy, meaning that some original image information is lost and cannot be restored, possibly affecting image quality.

There is an optional lossless mode defined in the JPEG standard; however, this mode is not widely supported in products.

There is a lossless form of JPEG but it is not widely supported and you do not get it by tweaking the quality setting - it's an entirely different process.

As correctly answered above, using a "typical" JPEG encoder at quality 100 does not give you lossless compression. Lossless JPEG encoding exists, but it's different in nature and seldom used.

I'm just posting to say why quality 100 does not mean lossless.

In JPEG compression information is mostly lost during the DCT coefficient quantization step (8-by-8 coefficient blocks are divided by a 8-by-8 quantization table, so they become smaller --> 'more compressible'). When you set JPEG quality to 100, no real quantization takes place (because the quantization table will be all 1s, at least with standard IJG-JPEG tables), so in fact you don't lose information here..

However, there are mainly two factors leading to information loss even when no quantization takes place:

  1. Typically, JPEG compression reduces color information (becase the human visual system is less senstitive to that than to lumimance). Therefore, even at quality 100 you may be carrying out chrominance subsampling (which means, dropping half or more Cb and Cr coefficients). When this happens, information is lost, even when no quantization happens. However, you can tell the encoder to preserve full chromimance (so called 4:4:4 color sampling).
  2. Nevertheless, JPEG encoding implies going to the DCT domain, which causes rounding of coefficients. Rounding discards some information. This will happen regardless of all other options.