How to convert jpg to webp in php
This article mainly introduces how to convert jpg to webp in php, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
Php jpg to webp method: 1, create a PHP sample file; 2, execute "$img- > setImageFormat (" webp "); $img- > writeImage (" 1.webp ");" code can be.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer.
PHP pictures are converted to webp format
Convert the picture 1.jpg to 1.webpjpjpg is the real address of the picture.
The code is as follows:
$img = new\ Imagick ("1.jpg"); $img- > setImageFormat ("webp"); $img- > writeImage ("1.webp"); Thank you for reading this article carefully. I hope the article "how to transfer jpg to webp in php" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!