etechflow / module-image-optimizer
Server-side WebP image optimization for Magento 2. No external API, no per-image fees, no rate limits — converts JPG/PNG to WebP locally via cwebp / Imagick / GD with graceful fallback. Emits <picture> with WebP source + JPEG fallback for browser compatibility. Native loading=lazy. Bulk + cron + CLI
Package info
github.com/etechflow/module-image-optimizer
Type:magento2-module
pkg:composer/etechflow/module-image-optimizer
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0
- magento/framework: ^103.0||^104.0
- magento/module-backend: ^102.0||^103.0
- magento/module-catalog: ^104.0||^105.0
- magento/module-config: ^101.2||^102.0
- magento/module-cron: ^100.4||^101.0
- magento/module-media-storage: ^100.4||^101.0
- magento/module-store: ^101.1||^102.0
- magento/module-ui: ^101.2||^102.0
Suggests
- ext-gd: PHP-GD with WebP support enabled (--with-webp). Most modern hosts have it; check with `php -r 'echo function_exists("imagewebp") ? "yes" : "no";'`.
- ext-imagick: ImageMagick PHP extension with WebP support — alternative to GD with higher conversion quality.
- etechflow/module-back-in-stock-notification: Optional. Existing ETechFlow suite customer? Bundle key activates this module too.
- etechflow/module-next-day-eligibility: Optional. Existing ETechFlow suite customer? Bundle key activates this module too.
README
Server-side WebP image optimization for Magento 2. No external API, no per-image fees, no rate limits.
Install
composer require etechflow/module-image-optimizer:^1.0
bin/magento module:enable ETechFlow_ImageOptimizer
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
# Restart php-fpm to clear OPcache (mandatory on prod with opcache.validate_timestamps=0)
Activate the licence
php tools/generate-license.php --module=image-optimizer --host=<your-domain>
Paste into Stores → Configuration → eTechFlow → Image Optimizer → License Key (or use the Bundle License Key if you're an ETechFlow suite customer).
Verify
bin/magento etechflow:io:verify
Twelve PASS lines means you're good to go.
Run the first bulk optimization
bin/magento etechflow:io:optimize
Walks pub/media/catalog/product/cache/, converts every JPEG/PNG to WebP. Resumable, idempotent, dedupes already-converted images.
After this finishes once, the <picture> block plugin starts emitting WebP variants automatically on every PDP / category page. New images cached by Magento are picked up on the next cron tick (every 5 min).
How it works
Three pieces:
- Conversion engine chain — tries
cwebpbinary first (fastest), then ImageMagick PHP extension, then PHP-GD. First available wins. No external API. - Per-image
<picture>block — when Magento renders<img src="x.jpg">, our plugin wraps it:<picture><source srcset="x.webp" type="image/webp"><img src="x.jpg" loading="lazy"></picture>. WebP-capable browsers grab the smaller file; the rest get the JPEG. Universal compatibility. - Bulk + cron CLI — convert existing inventory once, then trust the cron to keep up with new images.
Configuration
Stores → Configuration → eTechFlow → Image Optimizer:
- License Key — per-module key (or use Bundle License Key for the suite)
- Module Enabled — toggle the whole feature
- Quality — 1-100, default 80. Higher = larger files, marginal quality gain past ~85.
- Conversion engine order — pick which engines to try and in what order. Default: cwebp → Imagick → GD.
- Image coverage — which images to optimize: product catalog, search, cross-sells, CMS images, sliders.
- Bulk batch size — how many images per cron tick (default 200).
Honest caveats
- Requires PHP-GD with WebP support OR Imagick with WebP support OR
cwebpbinary installed. Most modern hosts have at least one. Runetechflow:io:verifyto confirm. - Doubles the size of
pub/media/catalog/product/cache/(JPEG + WebP coexist). Plan disk space accordingly — typically +25-40% growth. - After the first bulk run, your CDN cache needs a purge to start serving the new HTML with
<picture>tags.
Compatibility
- Magento Open Source 2.4.4 – 2.4.8
- Adobe Commerce 2.4.4 – 2.4.8
- PHP 8.1 / 8.2 / 8.3 / 8.4
- Hyvä Theme + Hyvä Checkout
- Luma theme
Support
info@etechflow.com — include your license key + Magento version when reporting issues.