ImageMagick GIF to WebP

Hi, I’m trying to convert a GIF to an animated WebP.

  • (tested in both Kirby 4.5 with PHP 8.3 and Kirby 5 beta with PHP 8.4)
  • ImageMagick Version 7.1.1.46 is installed and working
  • thumbs driver in kirby config is set to ‘im’ (since GD doesn’t support GIF to animated WebP)
  • custom bin location in kirby config is set correctly
  • converting images works generally
  • converting a GIF to an animated WebP technically works using $file->thumb(['format' => 'webp'])

but…

there are two issues:

  1. When using $file->thumb(['format' => 'webp']), the light-gray background in one of my test GIFs gets removed. This doesn’t happen with another GIF which has a dark background.
  2. In addition, the frames are cropped in a way that the remaining content fits exactly the image frame. This behavior only starts to appear in the second GIF with the dark background, when I add quality, width or height to the thumb method.

I know my descriptions sounds a bit weird. If there is something I need to clarify, I’ll do my best.


Many thanks in advance!

Have you tried to convert the GIF via the command line with imagick? To find out if it’s something about the way Kirby is using im or whether it’s a bug of imagick.