lovell / lovell/sharp

AVIF. Refactor default for `chromaSubsampling` option

Open
#3,589 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked-upstream-dependency enhancement
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

## Feature request

### What are you trying to achieve?

For AVIF output, set `chromaSubsampling` automatically, instead of depending on the user to select correct `chromaSubsampling` for a particular image.

afaik, `sharp` doesn't upscale (increase the number of colors) `chromaSubsampling` when converting `4:2:0` input to `4:4:4` output. So there's no visual benefit in outputting `4:4:4` for the `4:2:0` input.
- whereas, `4:4:4` output is larger in size as indicated in #2850

### When you searched for similar feature requests, what did you find that might be related?

- https://github.com/lovell/sharp/issues/2562
- https://github.com/lovell/sharp/issues/2850

### What would you expect the API to look like?

No public facing API changes. Internally, `sharp` or `libvips` should dynamically set `chromaSubsampling` based on the metadata of the input, if `chromaSubsampling` override is not provided.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing related issues #2562 and #2850, then trace AVIF output handling and how input metadata reaches the chromaSubsampling option. The work is done when the default is derived from the input metadata while an explicit chromaSubsampling override remains respected; no public API change is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.