My previous post was a bit unfortunate. The only relevant conclusion of it is that WebP does provide better compression ratios than JPEG for the same level of lossiness. Here is a new comparison method:
- Take the original image and compress it to WebP and JPEG using all possible quality levels. In both cases, the compression program accepts values between 1 and 100, so you get 200 compressed images.
- Find out the PSNR value (lossiness) for each compressed image.
- For a given requested PSNR value, we’ll estimate the image size by interpolating the closest available values (lower and higher)
According to this article, sensible PSNR values are between 20 (low-quality images, allowed for example when very limited bandwidth is available) and 50 (extremely high-quality images, often not necessary). I have used these four lossless images for the test (2048 x 2048 pixels each):
And these are the resulting line-point charts. If there is no data for a given PSNR value, it’s because it was not possible to create an image with that level of lossiness (all values were tested for the quality parameter of both compressors):
Relevant results can be seen in this table (click to see in PDF format):
- We can see that the WebP format is able to improve JPEG’s performance by about 40% in certain cases. Apparently they have targeted PSNR values in the range [25-30]. If you need a very low level of lossiness (PSNR above 35, for example) you may find that WebP is not better, or even is unable to provide such images.
- I had always suspected that it was mathematically impossible to significantly improve the JPEG compression ratios, but I am impressed by the performance of WebP, at least in the [25-30] range for PSNR (the vast majority of commercial images and video frames probably fall inside that range, by the way.)
- It will be interesting to see if Google adopts (or at least supports) this format in their web browsers, mapping apps, etc. Even if we assume that WebP is, let’s say, 30% better than JPEG globally, will it pay off in a context where capabilities, requirements, volumes etc. often evolve with a geometrical or exponential rather than linear pattern?