Skip to content

Commit 851e7e5

Browse files
author
apoca
committed
refactoring: improved image quality returned.
1 parent 5d42706 commit 851e7e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/handler.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export function imageprocess(event, context, callback) {
5757
Key: imageKey,
5858
})
5959
.promise()
60-
.then((data) => sharp(data.Body).jpeg({ quality: 70 }).toBuffer())
60+
.then((data) =>
61+
sharp(data.Body).jpeg({ quality: 95, progressive: true }).toBuffer()
62+
)
6163
.then((buffer) => {
6264
// generate a binary response with resized image
6365
const response = {
@@ -85,7 +87,7 @@ export function imageprocess(event, context, callback) {
8587
.then((data) =>
8688
sharp(data.Body)
8789
.resize(size.width, size.height)
88-
.jpeg({ quality: 70 })
90+
.jpeg({ quality: 95, progressive: true })
8991
.toBuffer()
9092
)
9193
.then((buffer) => {

0 commit comments

Comments
 (0)