Extension:WebP

The WebP extension creates  versions of already uploaded images and displays them, if the requesting browser supports WebP images.

This extension requires  and   to be installed on the server.

Configuration
// Enables WebP creation after a new image was uploaded $wgWebPEnableConvertOnUpload = true;

// Enables WebP creation after a thumbnail was created $wgWebPEnableConvertOnTransform = true;

// Compression quality of the image: 0 - 100 where 100 means most compressed $wgWebPCompressionQuality = 50;

// the strength of the deblocking filter, between 0 (no filtering) and 100 (maximum filtering). A value of 0 turns off any filtering. Higher values increase the strength of the filtering process applied after decoding the image. The higher the value, the smoother the image appears. Typical values are usually in the range of 20 to 50. $wgWebPFilterStrength = 50;

// when enabled, the algorithm spends additional time optimizing the filtering strength to reach a well-balanced quality. $wgWebPAutoFilter = true;

// Create images through the JobQueue $wgWebPConvertInJobQueue = true;

// Thumbnail Sizes to create through the maintenance script $wgWebPThumbSizes = [ 120,  320,   800,   1200,   1600 ];

Maintenance
A maintenance script exists to convert already uploaded images: php extensions/WebP/maintenance/convert_images.php

php extensions/WebP/maintenance/convert_images.php --no-thumbs
 * 1) To only convert non-thumbnails run

php extensions/WebP/maintenance/convert_images.php --thumb-sizes=1000,1250
 * 1) To create thumbnails of custom sizes run
 * 2) This will create two thumbnails with size 1000px and 1250px

php extensions/WebP/maintenance/convert_images.php --titles=ImageA.jpg,ImageB.png
 * 1) To only work on some images run

php extensions/WebP/maintenance/convert_images.php --overwrite
 * 1) To force the creation of already existing images run

php extensions/WebP/maintenance/convert_images.php --title-prefix=Example
 * 1) Only work on page titles matching a prefix
 * 2) Every page starting with prefix 'Example' will be selected

php extensions/WebP/maintenance/convert_images.php --file-type=png
 * 1) Only work on page titles matching a file-type
 * 2) Every page starting with file-type 'png' will be selected
 * 3) Can be combined with 'title-prefix'

Known Issues
Images uploaded by URL won't generate webp version automatically.