flutter_image_compress icon indicating copy to clipboard operation
flutter_image_compress copied to clipboard

Images compress by size

Open ChinmayaGit opened this issue 11 months ago • 1 comments

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.

ChinmayaGit avatar Feb 28 '24 10:02 ChinmayaGit

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.

mainser avatar Jun 04 '24 14:06 mainser