image_aplatir with transparency

Hello,
I am using image_aplatir to create webp images, which are great for efficiency.

I test if the browser supports webp, and if so, I compress to webp, otherwise fallback to JPG.

However, for some images, transparency is needed, so it would be handy if there is an image_ function that supports conversion to webp, but will keep transparency. Is this possible?

Kind regards

Have you tried with the « transparence » last argument of image_aplatir ?

See |image_aplatir - SPIP it only mentions GIFs but it could be OK also for webp and pngs…

See also https://git.spip.net/spip/filtres_images/src/branch/master/filtres/images_transforme.php#L35 The PHP comments are outdated but it seems it could be OK for webp to use a « true » as a last argument.