Arno Hoogma

ImageOptimizer Documentation

Arno Hoogma


First, install the addon using composer

composer require 4rn0/statamic-image-optimizer

Then, publish the assets by running

php artisan vendor:publish --provider="Arnohoogma\StatamicImageOptimizer\ServiceProvider" --force

Please note that before Statamic 4 was unleashed this addon was available as 4rn0/statamic-v3-image-optimizer. Much like Statamic is now just 'Statamic', the 'v3' part was dropped from this addon's name repository, etc. It will just be known as 'Statamic ImageOptimizer' going forward.


ImageOptimizer comes with a configuration file, which you can find at config/statamic/imageoptimizer.php after publishing the assets.

In this file you can configure whether the addon should automatically optimize image Assets, whether it should optimize Glide image manipulations, whether it should log detailed information about those optimizations and which optimizer commands it should run on which types of images.


This addon dynamically adds a Fieldtype to the Asset editor, with which you can the image optimization gains and run optimizations on it.

It also adds a Utility screen, where you can view all optimization gains as well as the addon's current settings and configured optimizers. It provides an option to run the optimization process on all Assets again.

Finally, it adds a please optimize:images Command which optimizes all your existing image Assets and clears the Glide cache.

Optimization tools

The addon will use the following optimizers if they are available on your system:

Here's how to install all the optimizers on Ubuntu:

sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo apt-get install gifsicle

Here's how to install the optimizers on MacOS (using Homebrew):

brew install jpegoptim
brew install optipng
brew install pngquant
brew install gifsicle

ImageOptimizer will try to find the executables in the following paths on your server, so please make sure you install the optimizers within these paths. You can customize these paths in the configuration file.


Sounds pretty technical, huh? Don't worry: ImageOptimizer comes with batteries included!