Convert jpg to webp using imagewebp
问题 I'm having trouble using imagewebp to convert an image to webp. I use this code: $filename = dirname(__FILE__) .'/example.jpg'; $im = imagecreatefromjpeg($filename); $webp =imagewebp($im, str_replace('jpg', 'webp', $filename)); imagedestroy($im); var_dump($webp); $webp returns true but when I try to view the webp-image in Chrome it just shows blank, but with the correct size. If I instead load the image and set headers with PHP (see below) it shows up, but with wrong colors (too much yellow).