📜 ⬆️ ⬇️

Image Optimization for Google PageSpeed

There is no limit to perfection, and Google PageSpeed ​​is proof of that. With it, in less than a minute you can get a detailed report on the performance of a Web page. In most cases, PageSpeed ​​will prompt you to optimize graphics. This is the most common problem and the most significant.



For example, even on the home page of Google Developers, you can compress graphics by 71%. The smaller the pictures weigh - the faster the site loads. Smaller pictures - less traffic - everything works faster. Visitors spend less time - everyone is happy.
')
This material is selected basic tools for optimizing graphics.

Server tools


The most frequent are images in JPG format. Basic tools:



PNG format is used for icons, logos and low-color images. Optimization tools:



Cloud tools




PageSpeed ​​module


Google bothered and released a module for Ngnix and Apache to improve the performance of sites. It increases the download speed, optimizing dofig any parameters , including pictures. It works automatically, you only need to install and enable it:

 pagespeed on; pagespeed FileCachePath /var/cache/nginx; 


The module does everything by itself - and analyzes HTML, and optimizes resources. For example, pinch pictures or minimizes statics. In the source of the page all the optimized resources will have a different path.

Direct resource optimization

After optimization, PageSpeed ​​saves the file in a new way. But what about the photos displayed via JavaScript? Or with links to your pictures on third-party resources? Here IPRO comes to the rescue - optimizing resources without departing from the cash register, or rather not changing the URL.

To do this, it is enough to include such instructions in the config (for Nginx):

 pagespeed InPlaceResourceOptimization on; 


Abstract


Source: https://habr.com/ru/post/258363/


All Articles