I am building an app in flutter where user can upload image of max-size 20mb and want image to be compressed before storing it on server side. Basically compression will be done at server site.
Ive tried sharp but it couldn't compressed even a single byte. Above is the code
module.exports = function resize(path, format, width, height) {
const readStream = fs.createReadStream(path);
let transform = sharp(path).png({
compressionLevel: 9,
adaptiveFiltering: true,
force: true,
quality: 80,
}).withMetadata().toFile('output.png',function(err){
console.log("error :- ",err);
});
return readStream;
};
Is image compression is possible using sharp?