Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I decrease the size of a bitmap without loss of resolution in Android?

I have an application that takes a picture from the camera and then I do some image processing operations on that picture. But that's taking too long, so I want to decrease the size of the bitmap before the image processing operations. The important part is that resolution must be good in the smaller image also. Is there a library in android or is there anybody who knows an algorithm for that operation?

like image 505
barzos Avatar asked Dec 06 '25 04:12

barzos


1 Answers

One method is to take the average of every n*n block and convert it to a single pixel. It isn't the absolutely sharpest method and won't be completely free of artifacts, but I think you'll find the real-world results to be acceptable - and it's very fast.

like image 136
Mark Ransom Avatar answered Dec 07 '25 18:12

Mark Ransom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!