Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in v0.29, it has bigger file sizes for avif images (37% worse) #2850

Closed
samuelfernandez opened this issue Aug 19, 2021 · 2 comments
Labels

Comments

@samuelfernandez
Copy link

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, actually caught the regression in my project with a renovate upgrade https://github.com/ng-easy/platform/pull/174

What are the steps to reproduce?

Compress an image to avif format

What is the expected behaviour?

Keep small filesizes

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?

Let me know if truly needed

Are you able to provide a sample image that helps explain the problem?

Yes, attached size regression avif sharp v0.29.zip

What is the output of running npx envinfo --binaries --system?

  System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
    Memory: 12.73 GB / 31.88 GB
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD
@lovell
Copy link
Owner

lovell commented Aug 19, 2021

https://sharp.pixelplumbing.com/changelog#v0290---17th-august-2021

v0.29.0 - 17th August 2021
AVIF encoding now defaults to 4:4:4 chroma subsampling. #2562

Try adding .avif({ chromaSubsampling: '4:2:0' }) to use the same behaviour as the previous version.

Perhaps you could also experiment with the quality and speed settings to see what combination works best for your scenario.

https://sharp.pixelplumbing.com/api-output#avif

@lovell lovell added question and removed triage labels Aug 19, 2021
@samuelfernandez
Copy link
Author

samuelfernandez commented Aug 19, 2021

That was a fast answer! It fixed the issue both for avif and heif, thanks a lot @lovell!

styfle added a commit to styfle/DefinitelyTyped that referenced this issue Nov 17, 2021
weswigham pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this issue Nov 17, 2021
kodiakhq bot pushed a commit to vercel/next.js that referenced this issue Nov 17, 2021
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes #31254 
- Related to lovell/sharp#2850
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes vercel#31254 
- Related to lovell/sharp#2850
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants