PHPackages                             aceextensions/module-imageoptimizer - 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. aceextensions/module-imageoptimizer

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

aceextensions/module-imageoptimizer
===================================

Image Optimizer module for Magento 2. Adds WebP and AVIF support and enforces ImageMagick.

1.1.0(3mo ago)27OSL-3.0PHPPHP ~8.1.0||~8.2.0||~8.3.0

Since Feb 23Pushed 3mo agoCompare

[ Source](https://github.com/aceextension/Aceextension_ImageOptmizer)[ Packagist](https://packagist.org/packages/aceextensions/module-imageoptimizer)[ RSS](/packages/aceextensions-module-imageoptimizer/feed)WikiDiscussions main Synced 1w ago

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

Aceextension Image Optimizer for Magento 2
==========================================

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

A premium, high-performance image optimization suite for Magento 2 that brings modern image formats (WebP, AVIF, SVG) and intelligent lazy-processing to your storefront.

🌟 Key Features
--------------

[](#-key-features)

### 🖼️ Modern Image Format Support

[](#️-modern-image-format-support)

- **WebP &amp; AVIF Generation**: Automatically serves ultra-compressed WebP and AVIF images to modern browsers, reducing page weight by up to 80%.
- **SVG Upload Support**: Enables secure upload and display of SVG vector graphics in product galleries, category banners, and CMS pages.
- **Enhanced Media Gallery**: Extends the Magento Admin to support modern formats across Product Images, Category Attributes, and the WYSIWYG Media Gallery.

### 🚀 Performance Breakthroughs

[](#-performance-breakthroughs)

- **Near-Zero Rendering Delay**: Revolutionizes image processing by deferring physical file generation from the initial page request to `pub/get.php`. This ensures near-instant TTFB (Time to First Byte).
- **Graceful Nativization**: Intelligently handles source images that are natively WebP or PNG without forcing unnecessary JPEG conversions.
- **Lazy Materialization**: Images are generated only when requested by the browser. If a user never scrolls to an image, it is never processed, saving CPU and disk cache.

### 🛠️ Technical Excellence

[](#️-technical-excellence)

- **PHP 8.1+ Optimized**: Fully modern codebase adhering to Magento 2 coding standards, strict typing, and PHP 8+ features.
- **ImageMagick Enforcement**: Intelligently hooks into the Magento Admin to warn administrators and enforce the use of `ImageMagick` over `GD2` for superior modern format support.
- **Pure PHP Implementation**: Operates entirely within the PHP environment, requiring no external binaries or complex proxy configurations for standard operation.

📦 Installation via Composer (Packagist)
---------------------------------------

[](#-installation-via-composer-packagist)

The recommended way to install this extension is via Composer.

```
composer require aceextension/module-imageoptimizer
bin/magento module:enable Aceextension_ImageOptmizer
bin/magento setup:upgrade
bin/magento cache:clean
```

⚙️ Configuration
----------------

[](#️-configuration)

Available under **Stores &gt; Configuration &gt; Aceextension &gt; Image Optimizer**:

- **Module Enabled**: The master switch for the module's validation and processing logic.
- **Replace Catalog Images with Modern Formats**: Toggles the automated URL rewriting on the frontend.
- **Catalog Output Format**: Select between WebP and AVIF for frontend output.
- **Enable Debug Logging**: Log detailed conversion and processing events to `var/log/system.log`.

[![General Configuration](docs/admin-config.png)](docs/admin-config.png)

🏗 Architecture Overview
-----------------------

[](#-architecture-overview)

The module utilizes a **Lazy Materialization** pattern:

1. **URL Hijacking**: Intercepts URL generation and rewrites `.jpg`/`.png` extensions to `.webp`.
2. **Processing Bypass**: Stops Magento from physically creating the resized file during the initial page request.
3. **On-Demand Processing**: When the browser requests the missing `.webp` file:
    - Nginx routes the request to `pub/get.php`.
    - Our `MediaPlugin` intercepts the request.
    - The plugin generates the required source image and instantly converts it to WebP/AVIF.
    - The optimized image is served with correct headers.

[![Frontend WebP Rendering](docs/frontend-network.png)](docs/frontend-network.png)

📋 Compatibility
---------------

[](#-compatibility)

- **Magento**: 2.4.4 / 2.4.5 / 2.4.6 / 2.4.7+
- **PHP**: 8.1 / 8.2 / 8.3
- **Graphics Library**: ImageMagick (Strongly Recommended &amp; Enforced via Admin UI Warning)
- **Note**: This module utilizes safe PHP Reflection on `Magento\Framework\Image\Adapter\Gd2` and `Magento\MediaStorage\App\Media` to enable modern format generation without core file modification.

📄 Recent Changes (Hardening)
----------------------------

[](#-recent-changes-hardening)

The following security and stability improvements were implemented in the recent release:

- **Harden AVIF handling**: Added guards for `imageavif` and `imagecreatefromavif`, ensuring graceful fallback to WebP if the server environment lacks native AVIF support.
- **SVG security**: Introduced an `enable_svg` configuration toggle to whitelist SVG uploads and implemented an `aroundOpen` plugin to prevent backend raster adapters from attempting to process vector graphics.
- **Reflection resilience**: Documented target Magento versions and introduced a "log once" mechanism for reflection failures to avoid log noise while maintaining visibility.
- **Centralized URL rewriting**: Consolidated all URL replacement logic into a single idempotent helper method to ensure consistent behavior across all frontend plugins.
- **Admin UX**: Added a Diagnostics report in the Store Configuration panel to provide instant visibility into PHP-GD/Imagick format capabilities.

📄 License
---------

[](#-license)

Copyright (c) 2019 Aceextensions Extensions ()

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance82

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~14 days

Total

2

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7df3ae913071815d642a0f9f3ba98e324eadfddefa0acc7cdfe567638f269def?d=identicon)[dsguptas](/maintainers/dsguptas)

---

Top Contributors

[![durgagupta](https://avatars.githubusercontent.com/u/2483758?v=4)](https://github.com/durgagupta "durgagupta (11 commits)")

### Embed Badge

![Health badge](/badges/aceextensions-module-imageoptimizer/health.svg)

```
[![Health](https://phpackages.com/badges/aceextensions-module-imageoptimizer/health.svg)](https://phpackages.com/packages/aceextensions-module-imageoptimizer)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1131.8M12](/packages/mollie-magento2)[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

68353.9k](/packages/run-as-root-magento2-prometheus-exporter)[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

282806.2k](/packages/baldwin-magento2-module-url-data-integrity-checker)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

1512.6k](/packages/mage-os-module-inventory-reservations-grid)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

1310.2k1](/packages/opengento-module-category-import-export)[loki/magento2-admin-components

Admin Panel grids and forms created via Loki Components

173.7k7](/packages/loki-magento2-admin-components)

PHPackages © 2026

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