-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?
Yes - 0.27.2
What are the steps to reproduce?
Converting a 4000px wide jpg to avif causes cpu to spike to 400% and takes 2.5gb of RAM vs a webp conversion taking 20% CPU and 200mb of RAM.
- It appears file size doesn't matter, only resolution. Tried with a 6MB jpg, and a 700k jpg as source, both 4000px wide
- This is happening on macOS and Debian
What is the expected behaviour?
Conversion to take up less RAM and CPU
Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
const avifOptions = {
quality: 50,
lossless: false,
speed: 8, // default is 5
chromaSubsampling: '4:2:0',
}
// AVif original
// -------------------------------------------------------------------------
await sharp(path.join(inputDirectory, file))
.toFormat('avif')
.avif(avifOptions)
.toFile(path.join(outputDirectory, `test.avif`))
// Avif half
// -------------------------------------------------------------------------
await sharp(path.join(inputDirectory, file))
.resize({ width: halfWidth })
.toFormat('avif')
.avif(avifOptions)
.toFile(path.join(outputDirectory, `test@0.5x.webp`))Are you able to provide a sample image that helps explain the problem?
What is the output of running npx envinfo --binaries --system?
macOS:
System:
OS: macOS 11.2
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Memory: 1.70 GB / 40.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node
npm: 6.14.10 - ~/.nvm/versions/node/v14.15.4/bin/npm
Debian:
System:
OS: Linux 5.4 Debian GNU/Linux 9 (stretch) 9 (stretch)
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 270.71 MB / 1.94 GB
Container: Yes
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 12.18.2 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
styfle and mrxbox98
