Skip to content

WebP & AVIF support

With increasingly better browser support for WebP and AVIF on the horizon, optimizing images becomes a lot easier. Our image processing engine now supports both formats.

Converting files

To convert an existing JPEG, GIF or PNG into a WebP or AVIF file, you need to use the thumb method.

<?= $image->thumb(['width' => 200, 'format' => 'webp']) ?>

Default format option

You can also set the default format option in your config file and convert all images unless you override the format option in the thumb method.


return [
  'thumbs' => [
    'format' => 'webp'

This is only recommended if you really find yourself converting 90% of your files to that format anyway. Otherwise you will need to override the default quite a lot.


The format option can also be used in srcset definitions.

  ['width' => 200, 'format' => 'webp'],
  ['width' => 200, 'format' => 'jpg']


The GDLib/SimpleImage driver currently only supports webp, ImageMagick supports webp and avif.

Be aware that not all browsers support the new formats yet.