dfa1234/ngx-image-compress

Cannot compress image of 103kb to fit in 1mb

Closed this issue · 5 comments

I'm using .uploadAndGetImageWithMaxSize(1) to read an image and compress it, but it fails to do this with this exact image, even though it is already fits. With other images that already fit 1mb it works fine.

The image: https://i.pinimg.com/736x/b1/14/da/b114da448d67cd47e22ef6b092dede46.jpg

That is not an issue
103kb < 1mb
So you can't compress (reduce the size) to a greater size.

But your method hides upload functionality, so I cannot decouple it and check myself if this is already under the specified size. Also, as I said, other pictures work fine, even though they are smaller than 1mb. But ok

Ok I understand, we need to check at the beginning if the required size is already there.
Thank for your contribution to the algorithm

Thank you 😊

image
I tested it and it's working exacely like this. You need to check the code on the demo web site + demo code to see how to do it (using promise error)