Mozilla Explores Faster Web Loading With Mozjpeg Encoder
Mozilla announces the Mozjpeg JPEG encoder to enable faster loading times for web pages
The Mozilla Foundation is seeking to improve the loading speeds of web pages with the launch of its ‘Mozjpeg’ Project.
The aim of the project is to “provide a production-quality JPEG encoder that improves compression while maintaining compatibility with the vast majority of deployed decoders.”
Better Compression
The project has developed a faster JPEG encoder that claims to to reduce file sizes by up to 10 percent on standard JPEG images.
JPEG is the most commonly used photography and image format used on the Internet (ahead of GIF and PNG files). Indeed, the file format is also one of the most commonly used by all types of software, including Microsoft Office and Adobe Photoshop. So anything that can be done to reduce the size of JPEG images could dramatically improve loading times of web pages.
“JPEG has been in use since around 1992,” explained Josh Aas, a senior technology strategist at Mozilla Corp, in a blog post. “The number of photos displayed by the average Web site has grown over the years, as has the size of those photos. HTML, JS, and CSS files are relatively small in comparison, which means photos can easily make up the bulk of the network traffic for a page load. Reducing the size of these files is an obvious goal for optimization.”
But according to Aas, production JPEG encoders have largely been stagnant in terms of compression efficiency. So the Foundation talked with a number of engineers to see if JPEG encoders have really reached their full compression potential after 20+ years.
Faster Loading
“We concluded that the answer is ‘no,’ even within the constraints of strong compatibility requirements,” Aas wrote. “With feedback on promising avenues for exploration in hand, we started the ‘mozjpeg’ project.”
Mozilla has therefore released version 1.0, which is a fork of libjpeg-turbo (a popular open-source JPEG codec) and combined it with ‘jpgcrush’ (a popular Perl script). Mozilla said it can now reduce file sizes, typically by 2-6 percent for PNGs encoded to JPEG. However with average JPEG file sizes, it achieved an average 10 percent reduction using a sample of 1,500 JPEG files from Wikimedia.
“It does this by figuring out which progressive coding configuration uses the fewest bits,” said Aas. “So far as we know, no production encoder has this functionality built in, so we added it as the first feature in ‘mozjpeg’.”
And the next step is to improve the encoding by making use of ‘trellis quantization‘, which is an algorithm that is typically used for video compression purposes.
The news that Mozilla is seeking to improve the loading speeds of web pages will be welcomed by many Internet users around the world. Less welcome news however is Mozilla’s intent to incorporate advertising to its Firefox web browser, through a new feature called ‘Directory Tiles’, which will replace some of the empty tiles which appear when opening a new tab.
Are you a Firefox enthusiast? Take our quiz!