
Mozilla has announced a new
mozjpeg project to create a high-quality JPEG encoder that will improve image compression while maintaining compatibility with existing decoders.
At each site, the number of JPEG files and their size are constantly increasing. Since HTML, JS, and CSS are relatively small, when you load a web page, the main traffic often falls on JPEG. So reducing the size of photos is an obvious goal for optimization, says Mozilla.
Existing JPEG encoders are often not very efficient. It is logical to switch to more modern algorithms (for example, JPEG2000 with wavelet transform or free WebP), and this topic has been repeatedly discussed. But Mozilla developers
say that the popularity of JPEG is too great. Created in 1992, this lossy compression standard has become widely accepted. The transition to the new format will take many years, because it is not compatible with the existing software. “We (in Mozilla) have no doubt that the algorithmic improvements will someday push this transition, perhaps soon. But even in this case, JPEG will be with us for a long time. ”
Thus, even with the introduction of a new lossy compression format, the improvement of the current JPEG encoder makes sense. Mozilla developers wondered if JPEG reached its highest possible level of compression in 22 years of evolution? They consulted with a lot of engineers and concluded that the answer is no, even taking into account the compatibility constraints with existing decoders. Therefore, it was decided to start the project mozjpeg.
')
To begin, Mozilla releases
version 1.0 , which is a fork of
libjpeg-turbo with the addition of jpgcrush script functionality in C. This perl script is often used to optimize photos without loss of quality. On a random sample of 1,500 photos from the Wikimedia script reduces the file size by an average of 10%, choosing a progressive encoding configuration with the least amount of bits. Since there is no such functionality in any popular coder, and libjpeg-turbo has
“other priorities” for the maintainer, it is decided to fork and add it there.
At the next stage, Mozilla plans
to introduce trellis quantization .
Those who wish to participate in the process and suggest ideas are welcome to the
dev-mozjpeg mailing list.