lovell / lovell/sharp

Adjust quality based on output file size

Open
#4,070 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

## Feature request

I know this feature has been requested a lot over the years, but we are in the future now so I'd like to think there's a way to do this that's smarter than the brute force approach.

### What are you trying to achieve?

Ultimately what I and I believe others are wanting to achieve is specific output size, so no matter what size file we are trying to compress, we can be sure that it's below `x`.

Yes we can [brute force](https://github.com/lovell/sharp/issues/1667#issuecomment-491594173) it, but that's not very performant.

I'd like to think with someone a lot smarter than me could potentially use some ML magic and come up with a better approach...

Anyone?

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

No file, test, or entry point is identified in the issue. Start by reviewing the linked brute-force approach and the existing sharp output-size behavior, then establish a concrete implementation scope and measurable completion criteria for reliably staying below a requested file size.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.