Optimize images when they are processed by the resource publisher

Installs: 2 553

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 6

Forks: 0

Open Issues: 0


3.1.2 2021-03-29 14:30 UTC


TYPO3 CMS package that optimizes images (jpg, png, gif, svg) for web presentation when they are published.

Using jpegtran, optipng, pngquant, gifsicle and svgo for the optimizations.


Install the package via composer.

composer require netlogix/nximageoptimizer

Optimization tools

Install all the optimizers on Ubuntu:

sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo npm install -g svgo
sudo apt-get install gifsicle

Install the binaries on MacOS (using Homebrew or MacPorts):

brew install jpegoptim
brew install optipng
brew install pngquant
brew install svgo
brew install gifsicle
port install jpegoptim
port install optipng
port install pngquant
port install svgo
port install gifsicle


Place the following in your .htaccess file and images will be replaced with WebP version.

	# Check if browser support WebP images
	# Check if WebP replacement image exists
	# Serve WebP image instead
	RewriteCond %{HTTP_ACCEPT} image/webp
	RewriteCond %{DOCUMENT_ROOT}/$0.webp -f
	RewriteRule (.+)\.(jpe?g|png)$ $0.webp [T=image/webp,E=accept:1]

Tell every caching proxy to cache based on "accept" header

	RewriteRule (.+)\.(jpe?g|png|webp)$ - [env=POTENTIAL_WEBP_IMAGE:1]
	Header merge vary accept env=POTENTIAL_WEBP_IMAGE

The Ubuntu source package for imagemagick does not declare a build dependency on libwebp-dev. Thus imagemagick gets built without webp support. To fix this install the webp package.

sudo apt-get install webp