I’m using SharpJS to resize a gif/webp image having large number of frames,
but I’m experiencing slow performance even though the frame size is 7kb, 15kb or 20kb and target frame dimension is 512×512. I have tried many gif and animated webp images to test it.
Here is relevant code snippet i have used:
const resizeOption = {
width: 512,
height: 512,
fit: 'contain',
background: {r: 0, g: 0, b: 0, alpha: 0},
}
const config = {quality}
if(delay){ config.delay = delay }
return await sharp(buffer, {animated:true})
.resize(resizeOption)
.webp(config)
// .timeout({ seconds: 1200 })
.toBuffer();
How to hadle this problem ?
Version:
"sharp": "^0.33.4"
node --version
v20.9.0