Any way to force generate of thumbnails in webp format?

As part of our product import process I am trying to force the generation of a named thumbnail config (Hero) by running this:

$image->getThumbnail("Hero")->getFileSystemPath();

This works but it only generates the Hero image in pjpeg format. Is there any way I can get it to generate the thumbnail in .webp format instead?

Most of our users are using Chrome which supports webp so I would like to pre-generate the webp version of the Hero image if possible.

Thanks,

Hey, you can use pimcore:thumbnails:image command to pre-generate thumbnails in the background. also see https://github.com/pimcore/pimcore/issues/5295

Thanks,

I think the code in the github issue is what I needed.

Cheers,