Image Optimizer



Magento Platform
Open Source (CE)
2.0, 2.1, 2.2, 2.3

Tech Specifications

Current Version:
Stable Build
23 July, 2019
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), reducing their file size without losing image quality and speed up your  site. The 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 install guetzli on your server and configure our extension to use guetzli. (See user guide for more information.)

Be aware of the following:
Guetzli is a "lossy" compressor. This means you will lose some image  quality. (By default our extension is using jpegtran and there is no  change in image quality after optimization.)
Guetzli is much slower than jpegran.


In order to pass the Google PageSpeed Insights test regarding image optimization Google Perceptual JPEG encoder "guetzli" is required. Use GTmetrix to check your image optimization status.


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

Warning! Extension relays 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 the visual quality of  the images if you use jpegtran which is used by default. However, it  will degrade image quality if you use a "lossy" compressor like guetzli. Our extension will NOT change the 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 the preparation of images for the web. Before  uploading images to the web (in this case Magento) you need to prepare  them. This is a wide subject but the most important things are:

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




  • An Easy way to enable or disable the 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 the percentage and number of optimized images.
  • Convenient "Clear Index" button for resetting progress bar and ability to start index and optimization processes again.


  • An Easy way to enable or disable the Scan and Reindex Process Cron Job.
  • Option to type Cron Expression for the Scan and Reindex Process.
  • An Easy way to enable or disable the Optimization Process Cron Job.
  • Option to type Cron Expression for the 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 the 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 the 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 the 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 the path to your PNG utility if it is already installed on your system.
  • PNG Utility Options allows you to set PNG utility options.



This extension is FREE, however support is NOT. Please understand that we get more than a few emails almost every day  asking for support. In most cases, problems are lack of basic Magento  knowledge and not reading Installation Instructions. Due to our other  projects, we do not have time to answer all of them. Because of this, we  cannot provide free support for our free extensions. However, we offer  very affordable support options.



Q: After upgrading from an older version of Image Optimizer to v2.1.0  (or newer) my old index data is gone and Progress Bar is reset?
A:  Image Optimizer v2.1.0 and newer save index data to a file instead of a  database. If you are upgrading from any previous version of Image  Optimizer prior to v2.1.0 you will lose old index data. Previously  optimized images will still be optimized but you will need to re-index  and re-optimize all images again. Optimizing images twice or multiple  times will not change the quality of images. Image optimization  utilities sense if images are optimized and just re-save images without  changing them.
To upgrade to new version delete all files from app/code/Apptrian/ImageOptimizer, then copy new extension files and issue following commands:

  • php bin/magento setup:upgrade
  • php bin/magento cache:flush

Then delete all files from: var/generation/Apptrian/ImageOptimizer directory.

Q: Image Optimizer does not work for me, is there anything I can do?
A: Maybe. First, follow Testing Instructions. The 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".) The third is to try 64-bit  Utilities option. The fourth 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 the 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 the name of the  binary, not a full path. (Some servers usually have jpegtran installed.  The 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, the 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 the 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 the 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 an example. Let's 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 the original  location on the server. Then use our extension to optimize it. Only if  you did 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  the 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 a much  smaller file using another. (Read one of the above FAQ for more  information on how to choose appropriate image format.)


A Word From the Author

Thank you very much for your interest in Image Optimizer extension.  You can rest assured that by choosing this extension you are getting  high-quality product despite the fact it is free. The same professional  approach, dedication, and care are invested in this product as if it is  paid one. If you find this product useful and want to say "thanks" you  can do that by rating it and writing a short review about it on Magento  Marketplace. Also, you can like, share and follow us on FacebookGoogle+Pinterest, and Twitter.

If you have any questions about extension or Magento in general feel free to contact us.

Release Notes

Back to top


  • Compatible with Open Source (CE) : 2.0 2.1 2.2 2.3
  • Stability: Stable Build
  • Description:

    * Fixed behavior when image index is corrupt to show line number where is corruption
    * Improvement of code according to the latest Magento standards


  • Compatible with Open Source (CE) : 2.0 2.1 2.2 2.3
  • Stability: Stable Build
  • Description:

    * Fixed RegEx for Exact Path validator
    * Fixed CSS bug with Magento 2.3.x
    * Fixed small grammar error in config
    * Updated code comments


  • Compatible with Open Source (CE) : 2.0 2.1 2.2
  • Stability: Stable Build
  • Description:

    * Compatibility with Magento 2.2


  • Compatible with Open Source (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