Media Gallery image optimization

The new Media Gallery provides an image optimization feature, which improves performance and decreases media file sizes on the storefront. This optimization is enabled by default and can be modified in the store configuration settings.

Configure image optimization

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel, expand Advanced and choose System.

  3. Expand Expansion selector Media Gallery Image Optimization and do the following:

    • Set Enable Image Optimization to Yes.
    • Enter the Maximum Width and Maximum Height values (in pixels) according to your needs.


When Media Gallery image optimization functionality is enabled, an optimized copy of an image is automatically inserted in the content from the Media Gallery instead of the original file.

When the Maximum Width and Maximum Height values are changed in the configuration, it updates all the existing optimized images that were previously inserted.

The Media Gallery Image Optimization requires that the queue consumers are running for regenerating optimized images when configuration is changed. See Manage message queues in the Configuration Guide for more details.

Optimization of animated GIF images is not supported. Such images may lose their animation after the image optimization process. To avoid this, make sure the animated GIF image size is under the maximum width and height defined by the Media Gallery Image Optimization configuration settings.