我正在开发类似的 Imgix 服务,并且正在使用 Sharp。
但是webp无损压缩Imgix得到的效果比Sharp好。在 Imgix 中具有相同宽度和高度的相同图像有 453 KB 和 Sharp 1.3 MB。
在不损失质量的情况下增加压缩的一些建议?
我正在使用的代码:
https.get(url, function (response) {
let transform = sharp().toFormat('webp').resize(width, height);
return response.pipe(transform).webp({lossless:true}).pipe(res);
});