我正在使用Nodejs Sharp将png图片转码/调整大小为jpg。是否有办法用白色(或其他浅色)替换透明而不是黑色?我找到了一个较旧的库的解决方案,但是Sharp似乎是最快最好的。
.background无效。
.then( data => Sharp(data.Body)
.resize(SIZES[resize_type].width, SIZES[resize_type].height)
.max()
.withoutEnlargement()
.background("white")
.toFormat('jpeg')
.toBuffer()
)