# Best practices to optimise images in Magento 2

> Speed up your Magento 2 store by losslessly compressing product and theme images using the Apptrian Image Optimizer extension.

Source: https://www.kualo.com/knowledgebase/magento-performance/best-practices-to-optimise-images-in-magento-v2
Updated: 2026-06-09

---

![Best practices to optimise images in Magento 2](https://kb-cdn.kualo.com/cc/24/cc2488a6c6d1e755504bfdaa560b703bc92055b6.jpg)

Page speed matters for both SEO and user experience, and images are one of the biggest contributors to slow load times. Magento 2 ships well optimised out of the box, but once you change your theme and start adding products, image optimisation becomes essential.

## Why lossless image optimisation?

Lossless optimisation compresses images by stripping unnecessary metadata, with absolutely no reduction in visual quality. Even images you have already processed - for example using Photoshop's Save for Web feature - can typically be reduced further. The gains per image are modest (around 10-15% on average), but across a full product catalogue they add up quickly.

![Before optimisation benchmark](https://kb-cdn.kualo.com/d5/8a/d58a5d76b88b8dcff9de8ddcfc7f92cd29241fcd.png)

Kualo servers have the required optimisation utilities pre-installed, so you can use the [Apptrian Image Optimizer](https://marketplace.magento.com/apptrian-image-optimizer.html) extension without any additional server configuration.

To benchmark your site before and after, we recommend [GTmetrix](https://gtmetrix.com/).

## Installing Image Optimizer

### Step 1 - Connect your store to Magento Marketplace

1. Log in to [Magento Marketplace](https://marketplace.magento.com) and go to your name > My Profile > Access Keys.
2. Copy your Public and Private keys.
3. In your Magento Admin, go to **System > Web Setup Wizard > System Config**.
4. Enter your Public and Private keys and save.

### Step 2 - Purchase the extension

1. Go to the [Apptrian Image Optimizer extension page](https://marketplace.magento.com/apptrian-image-optimizer.html).
2. Add it to your cart and complete the checkout (the extension is free).

### Step 3 - Install via Extension Manager

1. In your Magento Admin, go to **System > Web Setup Wizard > Extension Manager > Review and Install**.
2. If your store is correctly linked to Marketplace, the extension will appear in the list:

![Extension Manager showing Image Optimizer](https://kb-cdn.kualo.com/d4/9d/d49d47f82e8673f157dd4d080883f61e1fae8b80.png)

3. Click **Install** and follow the prompts to complete the installation.

:::warning
If the installation stalls on "Update pending", check that your Magento cron jobs are correctly configured.
:::

Once installed, go to **Stores > Configuration** where you will find the Apptrian Extensions section:

![Apptrian Extensions in Stores > Configuration](https://kb-cdn.kualo.com/f6/28/f628ecdbd20ab46a7af454ce54745f935494b04f.png)

## Configuring Image Optimizer

1. Click on **Utility** and set the following values:

| Setting | Value |
|---|---|
| Use 64-bit utilities | No |
| Log utility output | Yes |
| GIF utility exact path | `/usr/bin/gifsicle` |
| JPG utility exact path | `/usr/bin/jpegtran` |
| PNG utility exact path | `/usr/bin/optipng` |

2. Click **Save Config**.

3. Go back to the **General** section and set the **Batch Size**. A value between 50 and 100 is a sensible starting point - adjust based on the number of images in your store and your hosting plan.

## Running the optimisation

1. Click **Start Scan and Reindex Process** and wait for it to complete:

![Reindex complete](https://kb-cdn.kualo.com/b0/bb/b0bb06ad65c944fe4c665f7a3bb5784ad4dbde5c.png)

2. Click **Start Optimization Process**. The extension will process one batch of images at a time:

![Optimisation in progress](https://kb-cdn.kualo.com/91/5e/915e92fc449330bfe65c6ddf2ce39b9bbf38271b.png)

You can also schedule optimisation to run automatically as a cron job:

![Cron job configuration](https://kb-cdn.kualo.com/6a/14/6a14ecf6106519f42b7637ccafdcad26e07992e0.png)

## Flushing the cache

Once all images have been optimised, clear the Magento cache to ensure your store serves the updated files:

1. Go to **System > Cache Management**.
2. Click **Flush Magento Cache**, **Flush Cache Storage**, and **Flush Catalog Images Cache**.

Run your GTmetrix benchmark again to confirm the improvement:

![After optimisation benchmark](https://kb-cdn.kualo.com/c4/d9/c4d99ebb7d39887022b1737583b66c75b5d7ff8c.png)

If you need any help with this, [contact us](https://www.kualo.com/company/contact) and we will be happy to assist.

---

_Source: Kualo Knowledgebase — https://www.kualo.com/knowledgebase/magento-performance/best-practices-to-optimise-images-in-magento-v2 · © Kualo Ltd._
