Skip to content

WebpOptions

Sets WebP encoder options.

imgproxy: webp_options (alias webpo) · Availability: imgproxy Pro only

use SomehowDigital\ImgProxy\Url;
use SomehowDigital\ImgProxy\Option\WebpOptions;
$url = Url::create()
->source('https://example.com/image.jpg')
->options(new WebpOptions('lossless'));
$url->build();
// _/webpo:lossless/plain/https%3A%2F%2Fexample.com%2Fimage.jpg

The option appears in the URL as webpo:lossless.

Parameter Type Default Description
$compression string — The compression mode.
$smartSubsample bool — Use smart chroma subsampling.
$preset string — The WebP encoder preset.

A dash means the argument can be left out. Trailing arguments that are left out or null are dropped from the URL, while a null before a given argument leaves an empty slot, so the following arguments keep their position.

  • All arguments are optional. See the imgproxy reference for the available values.

imgproxy reference