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

Images compress by size #288

Open
ChinmayaGit opened this issue Feb 28, 2024 · 1 comment
Open

Images compress by size #288

ChinmayaGit opened this issue Feb 28, 2024 · 1 comment

Comments

@ChinmayaGit
Copy link

ChinmayaGit commented Feb 28, 2024

Platforms

Android, iOS, macOS, Web, Windows, Linux

Description

Basically what it does take an image and ask size let's say 500kb or less.
I exactly don't know which compression method your are using but I try to predict by value let's say if 100=28kb;200=35kb but I always get wrong prediction and I try height, widths devide method not worked.

Why

It is helpful for students or anyone wants to to upload image in a server but server has cap on size uploading and also in many areas.

@mainser
Copy link

mainser commented Jun 4, 2024

Basically what it does take an image and ask size let's say 500kb or less. I exactly don't know which compression method your are using but I try to predict by value let's say if 100=28kb;200=35kb but I always get wrong prediction and I try height, widths

I had a similar problem, in my case, I needed to upload an image of maximum 300kb or the API rejected the file, I tried to calculate the percentage that represents the required size of the total size, but it doesn't really work that way and compressed too much the image, more than required.

What I did was make my own utility in which I use a binary search algorithm to find the maximum quality that meets the size requirement, maybe this can work for you too.

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

2 participants