Skip to content

Commit

Permalink
Use sequentialRead while encoding images with sharp (#44881)
Browse files Browse the repository at this point in the history
This can reduce memory usage and might improve performance on some systems.

Related: Brooooooklyn/Image#34 (comment)
  • Loading branch information
Brooooooklyn authored Jan 14, 2023
1 parent d4a3c66 commit d61b076
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next/src/server/image-optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ export async function optimizeImage({
let optimizedBuffer = buffer
if (sharp) {
// Begin sharp transformation logic
const transformer = sharp(buffer)
const transformer = sharp(buffer, {
sequentialRead: true,
})

transformer.rotate()

Expand Down

0 comments on commit d61b076

Please sign in to comment.