Image Optimizer

Image Optimizer

Compatible With: Community 2.0, 2.1, 2.2

Tech Specifications

Current Version:
Stable Build
04 October, 2017
Extensions, Site Optimization, Performance
License Type:
Open Software License 3.0 (OSL-3.0)


Optimize your images, reduce their file size without losing image quality and speed up your site.

Other Extensions by Apptrian


Back to top

Apptrian Image Optimizer will optimize your images (GIF, JPG, PNG) reduce their file size without losing image quality and speed up your site. This extension is very easy to install and use. You can optimize images by clicking a button in Magento Admin or automatically by a configurable cron job. If you are an advanced user, you will be pleased to know that extension is fully configurable. You can change optimization options even swap utilities used for optimization with the ones you like. (By default our extension is using optimization utilities recommended by Google PageSpeed Insights and GTmetrix.)

Image Optimizer is fully compatible with Google Perceptual JPEG encoder "guetzli"

However you need to:

1. Install guetzli on your server.
This is not covered by our Installation and Support services. More info on how to install guetzli can be found here.

2. Configure our extension to use guetzli.
In our extension config in "Utility" section
For "JPG Utility" type guetzli
For "JPG Utility Exact Path" type full path where you installed guetzli or if you added it to the system path then type only name of the binary it should be guetzli
For "JPG Utility Options" type:
--quality 90 %filepath% %filepath%
you can adjust quality option to your liking.

3. Test optimization by using test images we provided and manually compare file size before and after optimization. (Configuring and testing guetzli is covered by our Installation and Support services.)

Warning! Before using our extension on real images you must test optimization utilities. Please follow configuration and testing instructions.

Warning! Extension relies on third party utilities (gifsicle, jpegoptim (32-bit only), jpegtran and optipng). It is also highly dependent on a server type and configuration. There is a possibility it will not work for you. Please understand that there is no PHP code we can write that will make previously mentioned utilities work if they are not compatible with your server nor circumvent your server configuration.

Our extension will NOT change visual quality of the images.

Our extension will NOT change resolution of the images.

Our extension is only the last step in the image optimization that will help you to pass Google PageSpeed Insights and GTmetrix test, it is not the substitution for best practices regarding preparation of images for the web. Before uploading images to the web (in this case Magento) you need to prepare them. This is wide subject but the most important things are:

  • Choose the right format for the image (gif, jpg, png) (Read the FAQs for more information)
  • Choose the right resolution for the image (Read the FAQs for more information)



Google PageSpeed Insights test has changed the rules regarding image optimization.

Use GTmetrix to check your image optimization status.

You can see the change in the example of our site.

In Google PageSpeed Insights type and click "Analyze" button. You will see that for several .jpg images our site home page does not pass the "Optimize images" test. (It was passing few months ago for the same images.)

Now go to GTmetrix test type and click "Analyze" button. You will see that our site passes the "Optimize images" test.

Our educated guess is that Google PageSpeed Insights test now requires lowering the .jpg image quality in order to pass the test. As we already pointed out our extension is set so it does not change image quality. If anyone knows the new rules for Google PageSpeed Insights test please contact us and provide the link. Thank you for your understanding.



  • Easy way to enable or disable extension.
  • Batch Size is the number of images to be optimized per click or cron execution.
  • Paths option is a text area field where you can type paths you want to be scanned for images.
  • Convenient "Start Scan and Reindex Process" button for scanning and reindexing images.
  • Convenient "Start Optimization Process" button for optimizing images.
  • Convenient Progress Bar will give you info about percentage and number of optimized images.
  • Convenient "Clear Index" button for resetting progress bar and ability to start index and optimization processes again.


  • Easy way to enable or disable Scan and Reindex Process Cron Job.
  • Option to type Cron Expression for Scan and Reindex Process.
  • Easy way to enable or disable Optimization Process Cron Job.
  • Option to type Cron Expression for Optimization Process.


  • Use 64-bit Utilities option will allow you to run 64-bit version of utilities.
  • Log Utility Output option allows you to log information about optimization process.
  • Force file permissions after optimization.
  • Utilities Path option allows you to swap optimization utilities.
  • GIF Utility allows you to set GIF optimization utility.
  • GIF Utility Exact Path allows you to specify path to your GIF utility if it is already installed on your system.
  • GIF Utility Options allows you to set GIF utility options.
  • JPG Utility allows you to set JPG optimization utility.
  • JPG Utility Exact Path allows you to specify path to your JPG utility if it is already installed on your system.
  • JPG Utility Options allows you to set JPG utility options.
  • PNG Utility allows you to set PNG optimization utility.
  • PNG Utility Exact Path allows you to specify path to your PNG utility if it is already installed on your system.
  • PNG Utility Options allows you to set PNG utility options.

User Guide

User Guide can be found in UserGuide.pdf file.  Please follow all Installation, Configuration, and Testing Instructions to the letter.

If you do not know how to install extension or you wish a professional to do it for you, we offer additional Installation service for a small fee.


Q: Image Optimizer does not work for me, is there anything I can do?

A: Maybe. First, follow Testing Instructions. Second step is to check permissions on files inside Image Optimizer "bin" directory. (Can be "app/code/Apptrian/ImageOptimizer/bin" or "vendor/apptrian/image-optimizer/bin".) Third is to try 64-bit Utilities option. Forth use "Utility Exact Path" options but before you do gifsicle, jpegtran, and optipng must be installed on your server (Contact your server support and ask them to install these for you and to send you full path where these are installed. Some hosting companies will do this other will not). If gifsicle, jpegtran, and optipng are added to system path you can just type name of the binary not a full path. (Some servers usually have jpegtran installed. Minimal version required for Image Optimizer to work is v8d but the latest version is preferable.)

Q: Why after clicking "Start Optimization Process" button, none of the images are optimized?

A: Utility binaries located in "app/code/Apptrian/ImageOptimizer/bin" or "vendor/apptrian/image-optimizer/bin" must be executable which means you have to set right permissions on files inside this directory.

Q: After clicking "Start Optimization Process" button, error message appears "Optimization failed because PHP exec() function is disabled."?

A: This means your server PHP is configured in such a way that PHP exec() function is disabled. Contact your hosting company and ask them to allow exec() function. This usually happens on shared hosting accounts and hosting companies keep this function disabled until you ask them to enable it. This function is needed in order for image optimization utilities to be executed. If you cannot execute optimization utilities you cannot optimize images.

Q: Why Google PageSpeed Insights reports my images are not optimized despite I optimized them properly and can see difference in file size (in bytes)?

A: Our extension only optimizes images on your site, it will not change format nor resolution of your images. This brings us to the best practices regarding images and web. You must prepare your images from the start if you want to pass Google PageSpeed Insights test. This means choosing the right format and resolution for every image.

Image Formats:

GIF is used for images that have very few colors (small web design elements). It is also used for simple animations if it is animated GIF (banners).

JPG is used for images with many colors (photos, product images, and some other design elements).

PNG is used for images where accurate transparency is needed (usually used for design elements, small element backgrounds/css sprites).

Resolution is best explained via example. Lets say you have an image on your site that is 2000x2000px. However on your page it is resized via CSS to 1000x1000px. This means your image is much bigger than it needs to be. If you check your page containing this image via Google PageSpeed Insights it will tell you something like this:

Compressing and resizing could save 110.1KiB (79% reduction).

You need to download image.jpg then resize it to 1000x1000px with the image editing program of your choice and upload back to original location on the server. Then use our extension to optimize it. Only if you done everything correctly you will pass Google PageSpeed Insights test.

Q: Progress bar is stuck?

A: This happens when in one batch of images there are many very large ones and due to memory and time limits for script execution optimization is aborted. To overcome this, lower the "Batch Size" option to 10. In some cases of very large images and certain server configurations you will need to set "Batch Size" to 1. After you optimize these large images you can set "Batch Size" back to default value of 50.

Q: Why are not all images optimized?

A: Only images that are on your server can be optimized. Also sometimes Google PageSpeed Insights will report .gif images with transparency not optimized despite the fact they are. For images that have transparency use .png files. There is also an edge case when you use one format while you would get much smaller file using another. (Read one of the above FAQ for more information on how to choose appropriate image format.)

Release Notes

Back to top


  • Compatible with CE: 2.0 2.1 2.2
  • Stability: Stable Build
  • Description:

    * Compatibility with Magento 2.2


  • Compatible with CE: 2.0 2.1
  • Stability: Stable Build
  • Description:

    + Compliance with Magento's Extension Quality Program (EQP)


Back to top
The best place to start if you need help with a specific extension is to contact the developer. All Magento developers have both a contact email and a support email listed.

Q & A

Back to top


Back to top