Images optimization in Magento

Images optimization in Magento is one of the simple ways to improve the performance on the store. The faster store is – more likely that users will complete order on it. Further below, in our article you will find the tips how to quickly optimize all the images on Magento website.

When you click a link to visit a website, the server calls all of the files of the website to load and, as a result, you will see them on your screen. Depending on website, the images could take a huge part in all files that need to be loaded. That is why it is always important to optimize images for the web. Obviously, the smaller the file’s size of the images is, the faster website will be loaded.
So, let’s get to the point and discover how to optimize images.

First of all, you should connect to the server via SSH. After it, install two utilities for optimizing *.png and *.jpg files. The first utility is optipng for optimizing PNG files. You will also need to fire the following command in your shell to install it:

apt-get install optipng

And the second one is jpegoptim for optimizing JPG files. In order to install this utility, fire the command below:

apt-get install jpegoptim

As a next stage, optimize PNG images in the media/catalog folder which usually is the heaviest one in Magento installation. For this, open the media folder and execute the command below. Its role is to find and optimize all the PNG images in all sub-folders of catalog/.

cd media
find catalog/ -iname *.png -print0 |xargs -0 optipng -o7

Once you have executed that command – wait for some time to see the result.

In order to optimize all JPG images, open catalog/ folder and there you will need to fire the similar command, but it will find and optimize all the JPG images in all sub-folders.

cd catalog
find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;

That’s it! Fast and effective solution. After performing the described above actions, your images will be optimized in few minutes. As you can see, there is no need to do it manually, like image by image. We hope that it was useful information for you and if you have any questions or some other tips about the images optimization – feel free to comment below.


Smart Brands Choose Us.

From Mark Cuban and Sir Richard Branson backed startups, to Inc 500 US Fastest Growing Companies and Global Brands choose us to deliver and support unparalleled eСommerce experience for their customers.