Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagick php 7.2 not setting webp format

I have ImageMagick 6.7.8-9 and cwebp and dwebp (libwebp, libwebp-devel) installed and working as expected from the command line.

I have php7.2 installed from webtatic.

the problem I'm facing is that php imagick is not wrking with webp extension (other formats are working fine) here's what I get when I try Imagick: Fatal error: Uncaught ImagickException: Unable to set image format in .... : Imagick->setimageformat('webp')

please help me, I googled a lot, stackoverflow has nothing regarding this issue.. any clue, guidance, answer will be apreciated, thanks in advance

like image 676
sami Avatar asked Mar 13 '18 12:03

sami


1 Answers

Don't use Imagick->setimageformat('webp') use the following syntax instead:

$imagick = new \Imagick('/tmp/foo.jpg'); $imagick->writeImage('webp:/tmp/foo.webp');

That should do the trick for you ;-)

like image 51
Bernhard Rusch Avatar answered Nov 03 '22 00:11

Bernhard Rusch