I convert animated gif to webp but the webp picture is not animated.
Did I miss a step? I don't find in the documentation.
my code:
//GD
$image = imagecreatefromgif("./mypics.gif");
imagepalettetotruecolor($image);
imagewebp($image, "./image.webp");
//Imagick
$img = new \Imagick("./mypics.gif");
$img->stripImage();
$img->setImageFormat("webp");
$img->setImageAlphaChannel(\imagick::ALPHACHANNEL_ACTIVATE);
$img->setBackgroundColor(new \ImagickPixel('transparent'));
$img->writeImage("./image.webp");
php-vips supports animated web. For example:
// n=-1 means load all pages
// sequential access means decode pixels on demand
$image = Vips\Image::newFromFile('something.gif', [
'n' => -1,
'access' => 'sequential'
]);
$image->writeToFile('something.webp');