Usually I import png images into Canvas by using
const image = Canvas.LoadImage('url.png')
const canvas = Canvas.createCanvas(256,256)
const ctx = canvas.getContext('2d')
ctx.drawImage(image,256,256)
but when i try to import a webp image, I get an error saying that webp isn't supported. On research into the Issues of node-canvas I found this issue, The importing issue appears to be solved but I dont understand how to import the webp images now.
I tried using the Image, ImageFromBuffer(await fetch(url).buffer()) from the fix in the issue but both give errors.
I solved it by using the library Sharp.
First get the file as a buffer
Convert the file to png using sharp:
Then you can use loadImage