ShortPixel ImageAPI Optimize processor plugin
ShortPixel ImageAPI Optimize Processor is a custom Drupal module that integrates the ShortPixel POST-Reducer API as an optimization processor for the ImageAPI Optimize module.
The processor automatically optimizes images generated by Drupal Image Styles by uploading the generated file to ShortPixel and overwriting only the generated image style file, while keeping the original source image untouched.
The module fully respects Drupal’s image handling architecture and Drupal best practices.
Features
Supported Compression Modes
The processor supports all official ShortPixel compression strategies:
Lossy – Best balance between image quality and file size. Recommended for most websites.
Glossy – High-quality compression with minimal visual loss. Ideal for photography and premium visuals.
Lossless – Pixel-perfect optimization with no visual changes. Best for technical images and graphics.
The compression mode can be selected directly from the ImageAPI Optimize processor configuration.
CDN Delivery Mode
The processor can also rewrite public image URLs to the ShortPixel Adaptive Images CDN format.
Enable Rewrite public image URLs to ShortPixel CDN
Set the CDN base URL to https://cdn.shortpixel.ai, https://no-cdn.shortpixel.ai, or your own CDN host
The module rewrites public image URLs to the Adaptive Images API format and keeps the selected compression mode in sync
When CDN delivery is enabled, local Post-Reducer uploads are skipped and the CDN handles optimization and format negotiation
Post-Installation
Drupal generates an image using an Image Style
(the image is stored under the /styles directory)
ImageAPI Optimize invokes the ShortPixel processor
The generated image is uploaded to ShortPixel via the POST-Reducer API
The processor polls the API until optimization is complete
The optimized image replaces the generated Image Style file
The original image remains unchanged, as required by Drupal standards
For a deeper technical explanation, see the inline documentation in ShortPixel.php.
Additional Requirements
The module needs a ShortPixel API Key that you can get for free at shortpixel.com - the free account includes 100 image optimization per month.