Compressing image in android is loosing the quality when image is taken from phone camera -


i using method compressing image https://gist.github.com/manzzbaria/c3af85b708fee49d55f7

but images loosing quality after compression. worse when image take phone , compressed.

please let me know doing wrong.

reducing size of image takes pixels away, reducing resolution of image. of course, file gets smaller. if save high-fidelity jpeg (say 95%), may file size reduction need.

reducing size of file lossless method (eg png) achieve reduction in file size no loss of quality — hence name. reduction depends on image: picture many identical pixels, eg screenshot of page, compress substantially.

using lossy method (eg normal jpeg compression) result in smaller file, pay reduction loss of quality. methods of saving jpegs allow choose fidelity, 80% default, controls quality of resulting image; line in code posted:

scaledbitmap.compress(bitmap.compressformat.jpeg, 80, out); 

again, reduction achieve inversely proportional complexity of image, fidelity parameter.

here's blog post wrote on choosing image formats: how choose image format. this one might worth reading.

there more links on lossy vs lossless compression in @gavriel's answer.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -