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

Proposal: Be smarter about quality level when converting images to JPGs #6112

Open
Novaenia opened this issue Nov 5, 2024 · 0 comments
Open

Comments

@Novaenia
Copy link

Novaenia commented Nov 5, 2024

When the Bluesky app converts an image to a JPG, it first starts at a quality level of 100%. If the resulting file is above the file size limit of 1MB, it drops the quality by 10% and tries again.

for (let i = 0; i < 9; i++) {
// nearest 10th
const quality = Math.round((1 - 0.1 * i) * 10) / 10

Each quality drop has diminishing returns - it is not linear. Often, going from 100% to 98-99% can shave off 25 to 30% of the size saved at 100% quality. Even just around 96% can result in a file that's less than half of the 100% size. Jumping from 100% to 90% sacrifices an unnecessary amount of quality. Here's a chart from Wikipedia.

I think this loop should be changed, so that every single quality level from 100% down to 100% is tested.

Sidenote: The <2000x2000 & <1MB constraint on images sucks anyway! It would be swell if it were to be raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant