PrestaShop 8.1+ / 9 module that speeds up product image generation by replacing GD with Imagick and enabling next-generation AVIF and WebP output.
By Coding974.
⚠️ Compatibility: PrestaShop 8.1.0 minimum. The AVIF format and theImageManager::resize()signature used here only exist from 8.1 onwards. On 1.7 and 8.0 the override would cause a fatal error — installation is therefore deliberately blocked below 8.1 (guard ininstall()).
- AVIF / WebP: images up to 50% lighter than JPEG at equal quality → faster pages, better SEO, less bandwidth.
- Imagick > GD: better resizing quality (Lanczos filter) and correct EXIF orientation handling.
- Faster generation thanks to two built-in optimizations:
- Decoded source caching — on upload, PrestaShop resizes the same photo ~10 times (5 JPEG formats + 5 AVIF). The image is decoded only once (~20 ms per clone instead of ~450 ms of re-decoding per format).
- Fast pre-scaling — on large studio photos (>3× the target size), a sampling-based reduction runs before Lanczos → ~10× faster, identical final quality.
- Automatic GD fallback: if Imagick is missing, the module stays safe and uses GD.
- PrestaShop 8.1.0 or higher (native AVIF).
- PHP with the Imagick extension enabled, ideally compiled with AVIF support (ImageMagick ≥ 7.0.25 + libheif/libaom). Without AVIF in Imagick, the other formats (JPEG/PNG/WebP) still work.
- PrestaShop quality settings are respected:
PS_JPEG_QUALITY,PS_PNG_QUALITY,PS_WEBP_QUALITY,PS_AVIF_QUALITY,PS_IMAGE_QUALITY,PS_IMAGE_GENERATION_METHOD.
Recommended — from the release: download the ZIP from the latest release, then in the back office: Modules → Module Manager → Upload a module → select the ZIP.
Then (for both methods):
⚠️ Only one override per method. If the shop already has a manualoverride/classes/ImageManager.phpoverride, delete it BEFORE installing the module (otherwise installation fails or refuses to copy the override).- Install "Coding974 AVIF & Imagick Optimizer" from the Module Manager.
PrestaShop automatically copies the override into
override/classes/and rebuilds the class index. (Installation is refused if the version is < 8.1.0.) - Regenerate thumbnails: BO → Preferences → Images → Regenerate thumbnails, to produce the new formats for the existing catalogue.
(Manual installation: copy the coding974avifoptimizer/ folder into modules/, then
install it from the back office.)
Uninstalling the module from the back office removes the override and returns PrestaShop to GD. Clear the cache if needed.
- The override extends
ImageManagerCoreand overridesresize(),create(),thumbnail()as well as theMIME_TYPE_SUPPORTED/EXTENSIONS_SUPPORTEDlists (adding AVIF/WebP/SVG). - The source cache is static: it only lives for the duration of the PHP request, with no persistent memory footprint.
- Everything is wrapped in
try/catchblocks with GD fallback and logging viaerror_log.
PrestaShop 8.1.x, 9.x. Single or multi-shop. (1.7 / 8.0 unsupported: no AVIF.)
Released under the MIT license — free to use, modify and redistribute. See the LICENSE file.
Built and shared with the community by Coding974.