I am trying to use imagemin with imagemin-pngquant to reduce images in an AWS Lambda function. Here is the code that I've made using the docs as a reference:
(image.data is the Buffer I'm creating from an axios .get()
with arrayBuffer
as the responseType)
// We want to minify the image before we upload it
let converted_image = await imagemin.buffer(await image.data, {
plugins: [
imageminPngquant({
quality: [.55, .65],
speed: 8,
strip: true
})
],
})
However, when I try to use the pngquant plugin to compress pngs, it does not work. Here is the exact error that I'm getting:
Error: Error: /var/task/node_modules/pngquant-bin/vendor/pngquant: /var/task/node_modules/pngquant-bin/vendor/pngquant: cannot execute binary file"}%