PHPackages                             mageplaza/module-image-optimizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. mageplaza/module-image-optimizer

AbandonedMagento2-module[Image &amp; Media](/categories/media)

mageplaza/module-image-optimizer
================================

Magento 2 Image Optimizer Extension

1.0.1(6y ago)37.8k9[3 issues](https://github.com/mageplaza/magento-2-image-optimizer/issues)proprietary

Since Aug 30Pushed 5y ago5 watchersCompare

[ Source](https://github.com/mageplaza/magento-2-image-optimizer)[ Packagist](https://packagist.org/packages/mageplaza/module-image-optimizer)[ RSS](/packages/mageplaza-module-image-optimizer/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Magento 2 Image Optimizer
=========================

[](#magento-2-image-optimizer)

[Magento 2 Image Optimizer](https://www.mageplaza.com/magento-2-image-optimizer/) can be considered as a must-have module for Magento 2 stores which have the need to compress and optimize their images. By optimizing the images, you will have the ability to reduce the page loading time, enhance the shopping experience as well as grow the conversion rate considerably.

1. Documentation
----------------

[](#1-documentation)

- [Installation guide](https://www.mageplaza.com/install-magento-2-extension/)
- [User guide](https://docs.mageplaza.com/image-optimizer/index.html)
- [Introduction page](http://www.mageplaza.com/magento-2-image-optimizer/)
- [Contribute on Github](https://github.com/mageplaza/magento-2-image-optimizer)
- [Get Support](https://github.com/mageplaza/magento-2-image-optimizer/issues)

2. FAQ
------

[](#2-faq)

**Q: I got an error: Mageplaza\_Core has been already defined**

A: Read solution [here](https://github.com/mageplaza/module-core/issues/3)

**Q: What image types are supported by Image Optimizer?**

A: Most common image types are supported, including PNG, JPG, and GIF.

**Q: Can you please let me know about the optimization process?**

A: At first, all files (of the directories that are included) will be scanned. After that, the scanned images will be optimized.

**Q: Is it possible to set up the optimization process to be automated by a specific schedule?**

A: Yes, it is absolutely possible. With the help of cron, the schedule to scan and optimize the image can be set on a regular basis.

**Q: How is the quality of the image after optimizing?**

A: Using Magento 2 Image Optimizer, you will have two options, which are Lossless and Custom. Choosing Lossless, you can reduce the size of the image while still retaining the quality of that image. On the contrary, you can define the quality percent of optimized images with the Custom option. However, please keep in mind that small file size equal with worse image quality.

3. How to install Image Optimizer extension for Magento 2
---------------------------------------------------------

[](#3-how-to-install-image-optimizer-extension-for-magento-2)

Before installing the extension, please [bought it here](https://www.mageplaza.com/magento-2-image-optimizer/)

Install via composer (recommend). Run the following command in Magento 2 root folder: (Available only for paid customers)

```
composer require mageplaza/module-image-optimizer
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

```

4. Highlight Features of Magento 2 Image Optimizer
--------------------------------------------------

[](#4-highlight-features-of-magento-2-image-optimizer)

### Optimize multiple types of images

[](#optimize-multiple-types-of-images)

[![Optimize multiple types of images](https://camo.githubusercontent.com/0c80b6a20abae127403fcfc674db76962b33fb90447105fca9bf9005a8e34f57/68747470733a2f2f692e696d6775722e636f6d2f785864367538762e706e67)](https://camo.githubusercontent.com/0c80b6a20abae127403fcfc674db76962b33fb90447105fca9bf9005a8e34f57/68747470733a2f2f692e696d6775722e636f6d2f785864367538762e706e67)

With [Magento 2 Image Optimizer](https://marketplace.magento.com/mageplaza-module-image-optimizer.html), various types of images such as PNG, JPG, and GIF can be compressed easily by the store admins. These three image types are the most common formats which are used by thousands of online stores to upload the pictures of their products and services. With compressed image size, you will be able to better your store site’s performance.

### Control image quality: lossless or lossy

[](#control-image-quality-lossless-or-lossy)

[![Control image quality](https://camo.githubusercontent.com/a5ac63594ab7073752fd6ee1ce42be0495bc2917f4e607a3ff8fedda19f0d868/68747470733a2f2f692e696d6775722e636f6d2f3775344d554a7a2e706e67)](https://camo.githubusercontent.com/a5ac63594ab7073752fd6ee1ce42be0495bc2917f4e607a3ff8fedda19f0d868/68747470733a2f2f692e696d6775722e636f6d2f3775344d554a7a2e706e67)

Setting the compression level is the most interesting feature of the Magento 2 Image Optimizer extension. There are two compression options which create different image quality and file size output that you can use: Lossless and Lossy.

On the one hand, Lossless is an option which allows admin to retain the quantity of image while downsizing its size. More specifically, by removing unnecessary meta data from image files, the file size will be decreased marginally.

On the other hand, Custom compression, also known as Lossy, will help you to reduce the file size dramatically. However, there will be a loss in the data of the original image file; in other words, the quality of the image will be affected. When Magento 2 Image Optimizer extension is applied to your store, the retained proportion of quality after the compression process can be set without a visible loss in image quality. As a result, you can retain full control of image quality as well as the compression level.

### Process optimization automatically

[](#process-optimization-automatically)

[![Process optimization automatically](https://camo.githubusercontent.com/005eba0d5847603daca036c7657a8e79564f820d0b531f217aea29ba75b31e23/68747470733a2f2f692e696d6775722e636f6d2f3078386d5169462e706e67)](https://camo.githubusercontent.com/005eba0d5847603daca036c7657a8e79564f820d0b531f217aea29ba75b31e23/68747470733a2f2f692e696d6775722e636f6d2f3078386d5169462e706e67)

You can activate the image compression on a regular basis by running cron. Thanks to this, the admin will no longer need to compress images manually.

Magento 2 Image Optimizer will scan all the available images and notify you about the optimization status. After that, this module will activate the optimization process to scan than compress images in certain times. Store admins will be able to save a great amount of time with this automated operation.

### Back up original images

[](#back-up-original-images)

[![Back up original images](https://camo.githubusercontent.com/15a26a2a27f3bec799a1fdba6edcc4c52538bf776fd55dfda89aaaf58fe41ddf/68747470733a2f2f692e696d6775722e636f6d2f696b6d4e3152732e706e67)](https://camo.githubusercontent.com/15a26a2a27f3bec799a1fdba6edcc4c52538bf776fd55dfda89aaaf58fe41ddf/68747470733a2f2f692e696d6775722e636f6d2f696b6d4e3152732e706e67)

To ensure the safety of original images, modifications should accompany with backup. With Magento 2 Image Optimizer, all images will be stored in an image directory, and store admins can roll-back any image and use it at any time if necessary.

The backup feature allows admins to freely modify the image without worrying about the original picture being lost.

### Included and excluded images directories

[](#included-and-excluded-images-directories)

[![Included and excluded images directories](https://camo.githubusercontent.com/ea3c9881f196dbaed2b570e0051c4160e2174dee0bfc704cf0d106db6178cfcb/68747470733a2f2f692e696d6775722e636f6d2f524c37706c4d302e706e67)](https://camo.githubusercontent.com/ea3c9881f196dbaed2b570e0051c4160e2174dee0bfc704cf0d106db6178cfcb/68747470733a2f2f692e696d6775722e636f6d2f524c37706c4d302e706e67)

In addition, you can also assign the image scan to certain directories of your site. From the admin backend, admins can include all directories which have the images being scanned and exclude ones which you would like to keep images from scanning.

Thanks to this separation, the scanning process will become much more time-saving and focussing. The directories which require original pictures with full quality will not be counted in the optimization process.

5. More Features of Magento 2 Image Optimizer extension
-------------------------------------------------------

[](#5-more-features-of-magento-2-image-optimizer-extension)

### Force File Permission

[](#force-file-permission)

Approve/ Disapprove permission for compressed file.

### Skip Transparent Image

[](#skip-transparent-image)

Allow skipping the transparent image during the process of optimization

### Record, Requeue And Restore

[](#record-requeue-and-restore)

All scanned paths, original size, optimized size, optimization status, optimized percent, error message are recorded. Also, the status of the optimized image can also be changed to pending and re-optimize. Besides, the optimized images can also be restored to original images.

### Run Manually

[](#run-manually)

By selecting the Optimize button at the Manage Images grid, you will be able to optimize images manually.

### Bulk Compress

[](#bulk-compress)

Allow multiple image paths and compress to be selected at the same time.

### Command Line

[](#command-line)

Command-line is supported for quick and convenient image optimization.

6. Full Image Optimizer Feature List
------------------------------------

[](#6-full-image-optimizer-feature-list)

### For Store Admins

[](#for-store-admins)

#### General

[](#general)

- Turn on/ off the module
- Turn on/ off image backup feature

#### Optimize Options

[](#optimize-options)

- Choose the quality of compressed images: Lossless or Custom
- Choose quality proportion of images after the optimization process
- Enable/ Disable skipping transparent images
- Enable/ Disable force file permission

#### Directory

[](#directory)

- Included directory whose images are scanned
- Excluded directories whose images are scanned

#### Cron Job

[](#cron-job)

- Allow/ Disallow scanning images
- Set the schedule for scanning
- Allow/ Disallow image optimization
- Set the schedule for optimization

#### Manage Images

[](#manage-images)

- Allow viewing scanned image paths
- Allow viewing image status after scanning and optimizing
- Allow viewing the size of the original and optimized file
- Allow viewing optimization percent
- Allow viewing error messages during optimizing
- Allow changing images to pending status
- Allow restoring images to original status
- Allow viewing progressing percent according to status: Pending, Error, Skipped, Success
- Display popup when compressing multiple images in bulk or click on optimize button
- Apply command line to optimize images quickly and conveniently

### For Customers

[](#for-customers)

- Access the information on the page faster
- Stop wasting too much of time for page loading
- Experience good shopping time

7. Image Optimizer User Guide
-----------------------------

[](#7-image-optimizer-user-guide)

### How to Configure

[](#how-to-configure)

#### 1. Configuration

[](#1-configuration)

Login to the Admin Magento, choose `Stores > Image Optimizer > Configuration`

[![](https://camo.githubusercontent.com/b90b432b5784d50264cac7b31af29079f2656bdc4f97c9ccc7e92a42bcb41b06/68747470733a2f2f692e696d6775722e636f6d2f4b6b4c6b5642572e706e67)](https://camo.githubusercontent.com/b90b432b5784d50264cac7b31af29079f2656bdc4f97c9ccc7e92a42bcb41b06/68747470733a2f2f692e696d6775722e636f6d2f4b6b4c6b5642572e706e67)

##### 1.1. General

[](#11-general)

[![](https://camo.githubusercontent.com/407c1bcd8ee9b2dd073015bea589bfacf06fcde7d051da2ba3ceef75a5550e1b/68747470733a2f2f692e696d6775722e636f6d2f4b3061434568642e706e67)](https://camo.githubusercontent.com/407c1bcd8ee9b2dd073015bea589bfacf06fcde7d051da2ba3ceef75a5550e1b/68747470733a2f2f692e696d6775722e636f6d2f4b3061434568642e706e67)

- **Enable**: Select **Yes** to use the module features. Support image types: JPG, PNG, GIF, TIF, BMP.
- **Backup Image**: If **Yes** is selected, the original image will be backed up at `var/ backup_image` directory before being optimized.

##### 1.2. Optimize Options

[](#12-optimize-options)

[![](https://camo.githubusercontent.com/d6016bfee2862c995266648a337fdebb12e1c724e4cd469d94fb4490e8d7e0b0/68747470733a2f2f692e696d6775722e636f6d2f467830544361312e706e67)](https://camo.githubusercontent.com/d6016bfee2862c995266648a337fdebb12e1c724e4cd469d94fb4490e8d7e0b0/68747470733a2f2f692e696d6775722e636f6d2f467830544361312e706e67)

- **Image Quality**: select the image optimization level, including 2 types:
    - **Custom**: a filter which help to remove some data. Noted that this will reduce the image quality so you should be careful with the level of image quality reduction as the image can be blurry and unclear. Choosing **Custom** will show more fields:
        - **Quality Percent**: Enter the percent in the **Quality percent** field which will be limited between 1 and 100. For good image quality, please maintain quality above 90. If left blank, default value is 92.
- **Lossless**: is a data compression filter. This does not reduce image quality but it will require uncompressed images before they can be rendered.
- **Skip Transparent Images**: If **yes** is selected, the white image or transparent image will be skipped during the optimization process. If you want to optimzie these transparent photos, you must **Restore** and **Requeue** them. The second way is just choosing "No" in this field, all the transparent images will be optimized too.
- **Force File Permission**:
    - If **No** is selected, there is no change on the image permission.
    - Select **Yes** to provide permission for optimized images. Choose **Yes** will show more fields:
        - **Select Permission**:
            - Enter the number presenting the permission in the **Select Permission** field to choose the permission types for optimized images. You can refer [more information here](http://linuxcommand.org/lc3_lts0090.php). Example: 0755, ...
    - This is a required field.

##### 1.3. Scan Directory

[](#13-scan-directory)

[![](https://camo.githubusercontent.com/27b6bf5efc6aae5a00dfa59b003358dc240869921d6efc9378a97d7ffc7fd342/68747470733a2f2f692e696d6775722e636f6d2f575471523046682e706e67)](https://camo.githubusercontent.com/27b6bf5efc6aae5a00dfa59b003358dc240869921d6efc9378a97d7ffc7fd342/68747470733a2f2f692e696d6775722e636f6d2f575471523046682e706e67)

- **Included Directories**:
    - Click **Add** button to enter the path into the path field. The entered paths will be scanned with images in that path. For example: `pub/media/catalog/product`, `pub/media/customer`.
    - If left blank, the system will scan the default directory of `pub/media/`. Click **Remove** to delete the entered path.
- **Excluded Directories**:
    - Select **Add** button to enter the path where you don't want to scan the image in that folder. For example: `pub/media/mageplaza`, `pub/ media/logo`.
    - If left blank, there is no limit to scan images with paths. Click **Remove** to delete the path if you still want to optimize the path.
- **Note**: If the path is in both **Excluded Directories** and **Included Directories**, then the scan with that path will not apply.

##### 1.4. Cron job

[](#14-cron-job)

[![](https://camo.githubusercontent.com/6e27ae32a745313fc55d758d2f4230cc66a570649a95cd40061570a583441523/68747470733a2f2f692e696d6775722e636f6d2f726535306f74472e706e67)](https://camo.githubusercontent.com/6e27ae32a745313fc55d758d2f4230cc66a570649a95cd40061570a583441523/68747470733a2f2f692e696d6775722e636f6d2f726535306f74472e706e67)

- **Enable Image Scan**: Select **yes** to automatically scan images after a certain period of time and display additional fields:
    - **Scan Schedule**: Enter the time in the **Scan Schedule** field, after the selected time will automatically scan the image. You can refer to [this link](https://www.mageplaza.com/faqs/how-configure-cronjob.html). For example:
        - Enter \*\*\*\*\* is every 1 minute automatically scan the image.
        - 20 \* / 3 \* \* \* is running every 3 hours on 20 minutes will scan the image.
        - Run Daily: is 00 \*\*\*. It will be run at 00:00 daily
        - Run Weekly: 00 \*\* 7 will be run at 00:00 Sunday, 00 \*\* 1 will be run at 00:00 Monday
        - Run Month: 001 \*\* will be run at 00:00 on 01/01/2019. **Note**: When entering values, between two values linked by spaces, start running scans. For example: \* \* \* \* \*
- **Enable Optimization**: Select **yes** to automatically optimize with scanned images after a certain time and display additional fields:
    - **Optimization Schedule**: Enter the time in Optimization Schedule field, after the selected time will automatically optimize the scanned images. Unscanned images will not be optimized. The time period entered in Optimization Schedule field is the same as the Scan Schedule field, you can refer to above.
    - **Limit Number of Images**: Enter the number of photos that each time you want to automatically optimize after the selected time period.

#### 2. Manage Images

[](#2-manage-images)

- Login to the Admin Magento, choose `Stores > Image Optimizer > Manage Images`
- Here recorded and statistics scanned image information and Optimize or not include information of the fields: Path, Status, Original Size, Optimized Size, Compression Level (%), Error Message , ....

[![](https://camo.githubusercontent.com/d9d52bba3f59aeab4922beecc3d850a911ec0cb98f3a473061ea6379849745dd/68747470733a2f2f692e696d6775722e636f6d2f4d596d593367332e706e67)](https://camo.githubusercontent.com/d9d52bba3f59aeab4922beecc3d850a911ec0cb98f3a473061ea6379849745dd/68747470733a2f2f692e696d6775722e636f6d2f4d596d593367332e706e67)

- Click **Scan Images** button to start scaning all images. Only optimize the scanned images.
- Choose **Optimize Images** button to optimize with the scanned images.
- With **Optimize Action**, you can choose optimize with each image or all scanned images without optimizing, the optimized images will not be optimized anymore.
- If **Restore**, the image returns to skipped status and will ignore the optimize image. - **Re-Queue**: the image returns to the pending state.
- **Delete**: Delete images that you don't want to optimize.
- **Progress**: recounting the status of the photo with Pending, Error, Skipped, Success.
- Display popup when clicking **Mass Action Optimized** or button **Optimize Image**. When **Optimize** is clicked, the Progress bar displays 0%, and displays the first image. Click **Stop** if you want to stop the pptimize process.

[![](https://camo.githubusercontent.com/848c3b4acafcc5fdb1195c93fe94bc3dbfcfcdcc0ad4624804b0ef1fa1bb5c76/68747470733a2f2f692e696d6775722e636f6d2f79315a455336742e706e67)](https://camo.githubusercontent.com/848c3b4acafcc5fdb1195c93fe94bc3dbfcfcdcc0ad4624804b0ef1fa1bb5c76/68747470733a2f2f692e696d6775722e636f6d2f79315a455336742e706e67)

- Display the popup when clicking **Stop** with message `Are you sure you want to stop optimizing images?`

[![](https://camo.githubusercontent.com/35e536fcc3e903bbc64c8472d595e5a441b16e1a511ae1f6c6352a06d5a93411/68747470733a2f2f692e696d6775722e636f6d2f31334e773547502e706e67)](https://camo.githubusercontent.com/35e536fcc3e903bbc64c8472d595e5a441b16e1a511ae1f6c6352a06d5a93411/68747470733a2f2f692e696d6775722e636f6d2f31334e773547502e706e67)

#### 3. Command line

[](#3-command-line)

It is possible to run the following command to optimize images quickly, conveniently and the number of images after each optimize will be based on the value of the Limit Number of Images field in the Configuration section:

```
php bin/magento mpimageoptimizer:optimize

```

Also, please run the following command to scan images following the confiruration at the field **Scan Directory**:

```
php bin/magento mpimageoptimizer:scan

```

**Get more Magento 2 extension on Github**

- [Magento 2 Instagram Feed](https://github.com/mageplaza/magento-2-instagram-feed)
- [Magento 2 Social Login](https://github.com/mageplaza/magento-2-social-login)
- [Magento 2 SEO extension](https://github.com/mageplaza/magento-2-seo)
- [Magento 2 Blog extension](https://github.com/mageplaza/magento-2-blog)
- [Magento 2 Lazy Loading](https://github.com/mageplaza/magento-2-lazy-loading)
- [Magento 2 Security extension](https://github.com/mageplaza/magento-2-security)
- [Magento 2 Cron Schedule](https://github.com/mageplaza/magento-2-cron-schedule)

**Explore our pupular extension:**

- [Magento 2 Order Export](https://www.mageplaza.com/magento-2-order-export/)
- [Magento 2 Custom Stock Status](https://www.mageplaza.com/magento-2-custom-stock-status/)
- [Magento 2 Import / Export Categories](https://www.mageplaza.com/magento-2-import-export-categories/)
- [Magento 2 Import Export CMS](https://www.mageplaza.com/magento-2-import-export-cms/)
- [Magento 2 Mass Product Actions](https://www.mageplaza.com/magento-2-mass-product-actions/)
- [magento 2 Two Factor Authentication extension](https://www.mageplaza.com/magento-2-two-factor-authentication/)

**Our extension on Marketplace:**

- [Magento 2 Popup extension](https://marketplace.magento.com/mageplaza-module-better-popup.html)
- [Magento 2 Multi Flat Rates](https://marketplace.magento.com/mageplaza-module-multi-flat-rates.html)
- [Magento 2 Same Order Number](https://marketplace.magento.com/mageplaza-module-same-order-number.html)
- [Magento 2 Two-Factor Authentication](https://marketplace.magento.com/mageplaza-module-two-factors-authentication.html)
- [Magento 2 Import Export CMS](https://marketplace.magento.com/mageplaza-module-import-export-cms.html)
- [Magento 2 Custom Stock Status](https://marketplace.magento.com/mageplaza-module-custom-stock-status.html)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~178 days

Total

2

Last Release

2319d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2810172?v=4)[Sam Ng](/maintainers/imsamthomas)[@imsamthomas](https://github.com/imsamthomas)

![](https://www.gravatar.com/avatar/791d20a969b428c77a439388be23f94f3ce34d9cbc8ecd09bfccdb7e41b5d7ca?d=identicon)[haitv282](/maintainers/haitv282)

---

Top Contributors

[![imsamthomas](https://avatars.githubusercontent.com/u/2810172?v=4)](https://github.com/imsamthomas "imsamthomas (2 commits)")[![brianmageplaza](https://avatars.githubusercontent.com/u/7621931?v=4)](https://github.com/brianmageplaza "brianmageplaza (1 commits)")[![haonv01](https://avatars.githubusercontent.com/u/34636961?v=4)](https://github.com/haonv01 "haonv01 (1 commits)")[![phuongnth-mageplaza](https://avatars.githubusercontent.com/u/60681196?v=4)](https://github.com/phuongnth-mageplaza "phuongnth-mageplaza (1 commits)")

### Embed Badge

![Health badge](/badges/mageplaza-module-image-optimizer/health.svg)

```
[![Health](https://phpackages.com/badges/mageplaza-module-image-optimizer/health.svg)](https://phpackages.com/packages/mageplaza-module-image-optimizer)
```

###  Alternatives

[mageplaza/magento-2-social-login

Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps

1841.2M5](/packages/mageplaza-magento-2-social-login)[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[mageplaza/magento-2-seo-extension

Magento 2 SEO extension

141527.1k2](/packages/mageplaza-magento-2-seo-extension)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
