I am trying to compress PNG files (above 1MB) using node.js sharp package.
var sharp = require('/usr/local/lib/node_modules/sharp');
sharp('IMG1.png')
.png({ compressionLevel: 9, adaptiveFiltering: true, force: true })
.withMetadata()
.toFile('IMG2.png', function(err){
if(err){
console.log(err);
} else {
console.log('done');
}
});
Above code is not working properly. I have a file size around 3.5MB and I am trying to compress it around 1MB.