There is another way to compress
Posted: Tue Jan 21, 2025 8:28 am
Working on images
Compression
Caching
File minification
Loading order
CDN
Scripts and Plugins
Servers
and much more
If you are now thinking “nothing unusual, others have this information too”, then believe me, we still have something to surprise you with.
Working on images
Since images are often the most influential factor in speed, they are the place to start. There are a number of recommendations for working on images:
Work on the size
Choose the right format
Optimize
Postpone the download
Use sprites
Image size
As a rule, all services give an error if the image size is more than 100 kb. This is a good guideline, but not mandatory. For example, if you have 30 icons on a page, and they all weigh 90 kb, conditionally - this will not be an error, but in fact, the page will load longer than it could.
Regardless of how much the image weighs before you upload it to the site, it needs to be optimized.
Why add 512x512 icons to a page if you shrink them to 100x100 using CSS? It's better to shrink them to the desired size using a graphics editor right away, and at the same time reduce their quality a little. For example, the same Photoshop allows you to change the quality using 12 values.
Initial value
Initial value
If you move the slider down from 12 to 8, nothing will change visually, but you will win a few kilobytes.
Optimized value
Optimized value
Within one image, it’s pennies, but if you have the same 30 icons, then in total it can be a good boost.
In the example above we saved 100kb from just one image.
The next step to optimize this image is to remove metadata. By default, the image has information about the author, time and place of shooting, camera, a graphic editor can add their own information to the metadata. This still has weight, which is better to reduce.
Removing meta
Removing meta
You can do this using any online or offline service. In our example, we have reduced the image size to 51.8kb. Recall that initially it weighed 179kb.
an image well - change its format.
Changing the image format
Let's conduct another experiment. Let's take our banner for the VK group and save it in three formats:
Jpg
Png
SVG
And let's evaluate the result.
The banner itself is simple, with only two colors.
Our VK banner
Our VK banner
After saving the image in three formats, we received the following data:
JPG - 179 kb (without changing quality settings)
PNG -28.6 kb
SVG — 5.66 kb
It would seem that JPG has lost. But what if we take a large, full-size photo. For example, this one:
Test photo
Test photo
This time we will conduct an experiment "as gambling data korea phone number ourselves". That is, with full optimization, in order to identify the best result.
Total:
JPG — 293kb
PNG — 1.7mb
SVG — 2.63mb
What can we conclude from this? If you are using single-color images with a small number of colors, then it is preferable to use the SVG format. However, if you have high-quality photos, then JPG is what you need.
You see how important it is to choose the right image format for your website. However, even choosing the right format does not always help to significantly reduce page loading time, especially when there are dozens of images on it.
Compression
Caching
File minification
Loading order
CDN
Scripts and Plugins
Servers
and much more
If you are now thinking “nothing unusual, others have this information too”, then believe me, we still have something to surprise you with.
Working on images
Since images are often the most influential factor in speed, they are the place to start. There are a number of recommendations for working on images:
Work on the size
Choose the right format
Optimize
Postpone the download
Use sprites
Image size
As a rule, all services give an error if the image size is more than 100 kb. This is a good guideline, but not mandatory. For example, if you have 30 icons on a page, and they all weigh 90 kb, conditionally - this will not be an error, but in fact, the page will load longer than it could.
Regardless of how much the image weighs before you upload it to the site, it needs to be optimized.
Why add 512x512 icons to a page if you shrink them to 100x100 using CSS? It's better to shrink them to the desired size using a graphics editor right away, and at the same time reduce their quality a little. For example, the same Photoshop allows you to change the quality using 12 values.
Initial value
Initial value
If you move the slider down from 12 to 8, nothing will change visually, but you will win a few kilobytes.
Optimized value
Optimized value
Within one image, it’s pennies, but if you have the same 30 icons, then in total it can be a good boost.
In the example above we saved 100kb from just one image.
The next step to optimize this image is to remove metadata. By default, the image has information about the author, time and place of shooting, camera, a graphic editor can add their own information to the metadata. This still has weight, which is better to reduce.
Removing meta
Removing meta
You can do this using any online or offline service. In our example, we have reduced the image size to 51.8kb. Recall that initially it weighed 179kb.
an image well - change its format.
Changing the image format
Let's conduct another experiment. Let's take our banner for the VK group and save it in three formats:
Jpg
Png
SVG
And let's evaluate the result.
The banner itself is simple, with only two colors.
Our VK banner
Our VK banner
After saving the image in three formats, we received the following data:
JPG - 179 kb (without changing quality settings)
PNG -28.6 kb
SVG — 5.66 kb
It would seem that JPG has lost. But what if we take a large, full-size photo. For example, this one:
Test photo
Test photo
This time we will conduct an experiment "as gambling data korea phone number ourselves". That is, with full optimization, in order to identify the best result.
Total:
JPG — 293kb
PNG — 1.7mb
SVG — 2.63mb
What can we conclude from this? If you are using single-color images with a small number of colors, then it is preferable to use the SVG format. However, if you have high-quality photos, then JPG is what you need.
You see how important it is to choose the right image format for your website. However, even choosing the right format does not always help to significantly reduce page loading time, especially when there are dozens of images on it.