fluttercandies / flutter_image_compress

flutter image compress
MIT License
632 stars 215 forks source link

Should it be cropping and changing ratio? #286

Open DannyJoinedApps opened 6 months ago

DannyJoinedApps commented 6 months ago

Platforms

dart, Android, iOS

Description

I guess I've misunderstood how the dimenstions work. Normally these compression APIs try to avoid cropping and changing ratio of original, but this one does, so I guess I've misunderstood how the minWidth & minHeight work. If I set those values lower than the original, I get the top and bottom missing (assuming height is the constraint). With other compression libraries, I expect to find a 'maxHeight' parameter rather than the minimum one (at least its name that) in yours this one, and it is usually used in an algorithm seeking to reduce the max constraint (h or w) depending on if / either goes over the maximums defined. Then calculating a scale value while maintaining the original ratio. However, this one seems to crop the original if it receives an original out of bounds to the 'min' values. By the way, not sure how they are 'minimal' exactly, if the original is higher they are ignored, if not they are taken to be the maximum size. At least that seems to be how it behaves.

The example dart code to exemplify how the kotlin behaves doesn't result in the same numbers by the way.

My code

No response

Try do it

No response