From mediawiki.org
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: experimental
Implementation Media, File repository
Description Creates WebP versions of uploaded images
Author(s) (Octfxtalk)
Latest version 1.0.0
MediaWiki ~1.35
PHP >=7.3
License GNU General Public License 2.0 or later
Example https://star-citizen.wiki

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

This extension requires imagick and libwebp to be installed on the server.

Thumbnails can both be generated on parse or through thumb.php, they require that the source file is converted to webp. This can be done by running php extensions/WebP/maintenance/ConvertImages.php --no-thumbs.

This extension registers itself as a local file repo!

Note: While thumb.php links don't contain the .webp extension, the returned thumbnail will be a webp file.

More information can be found in the Readme.



If you wish to uninstall the extension remove the extension and delete the images/webp and images/thumb/webp folders.


// 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 = [


A maintenance script exists to convert already uploaded images:

php extensions/WebP/maintenance/ConvertImages.php

# To only convert non-thumbnails run
php extensions/WebP/maintenance/ConvertImages.php --no-thumbs

# To create thumbnails of custom sizes run
# This will create two thumbnails with size 1000px and 1250px
php extensions/WebP/maintenance/ConvertImages.php --thumb-sizes=1000,1250

# To only work on some images run
php extensions/WebP/maintenance/ConvertImages.php --titles=ImageA.jpg,ImageB.png

# To force the creation of already existing images run
php extensions/WebP/maintenance/ConvertImages.php --overwrite

# Only work on page titles matching a prefix
# Every page starting with prefix 'Example' will be selected
php extensions/WebP/maintenance/ConvertImages.php --title-prefix=Example

# Only work on page titles matching a file-type
# Every page starting with file-type 'png' will be selected
# Can be combined with 'title-prefix'
php extensions/WebP/maintenance/ConvertImages.php --file-type=png

Known issues[edit]

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