Sharp: Image Resize - Quality Settings

Created on 28 Mar 2018  路  2Comments  路  Source: lovell/sharp

Good day, I am trying to resize an image, currently 300x300 pixels down to 100x100...

sharp(bufferResponse)
.resize(100, 100)
.toBuffer((err, data, info) => {
// handle resized response
});

I am having difficulty finding a setting for "quality" in the API docs which could apply to the above snippet. I need to retain the highest quality possible. Could someone point me in the right direction please?

Appreciate any assistance, Thanks in advance

question

Most helpful comment

let bufferResponse = Buffer.concat(bufs);
sharp(bufferResponse)
.jpeg({ quality: 100, progressive: true })
.resize(100, 100)
.toBuffer((err, data, info) => {
// handle resized response
});

Issue resolved, thanks

All 2 comments

Hello, if you're referring to the "quality" setting for JPEG output, please see the jpeg docs.

let bufferResponse = Buffer.concat(bufs);
sharp(bufferResponse)
.jpeg({ quality: 100, progressive: true })
.resize(100, 100)
.toBuffer((err, data, info) => {
// handle resized response
});

Issue resolved, thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kachurovskiy picture kachurovskiy  路  3Comments

knoxcard picture knoxcard  路  3Comments

OleVik picture OleVik  路  3Comments

paulieo10 picture paulieo10  路  3Comments

emmtte picture emmtte  路  3Comments