Convert Bitmap To Gray Scale In Android

The best code in Android that worked for me in converting a colored Bitmap to gray scale is this one.

Notice that before the object is returned, I added two lines of code src.recycle() and src = null? This is to ensure that the non-used Bitmap object will be recycled to help avoid OutOfMemory exception errors.

Now, this is a necessity because unless you restrict your app to only run in smart phones with large RAM, you have to take this into account in order for your app to run seamlessly on smart phones that do not have have large amounts of RAM.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *