Libvips PHP: How to make WEBP file with given compression?

Viewed 137

I have code that converts and resize jpg to webp. One thing I can't solve: how to set compression. Code is like that:

use Jcupitt\Vips;

$vips = Vips\Image::newFromFile('src_file.jpg');

$thumb1 = $vips->thumbnail_image(1200);

$thumb1->writeToFile('new_name.webp');

This code works and uses default compression. But I want to make file size smaller. Tried following adjustments to code:

$thumb1 = $vips->thumbnail_image(1200, ['Q=2,optimize_coding']);
$thumb1 = $vips->thumbnail_image(1200, ['Q=2']);
$thumb1->writeToFile('new_name.webp', ['Q=2']);

and many more variants but file size doesn't change. Please help.

1 Answers
Related