If you’re an Android developer, then you know how difficult it can be to remove image backgrounds. But with this new library, it’s now a breeze! With just a few lines of code, you can easily remove image backgrounds from your Android app.
This library is perfect for developers who want to add images to their apps but don’t want to deal with the hassle of removing backgrounds. Simply call the library’s methods and pass in an image URL or file path, and the background will be automatically removed. You can also specify if you want the edges of the foreground object(s) to be smoothed out.
So if you’re looking for an easy way to add images to your Android app without all the hassle, check out this new background remover library today!
Gradle
Add it to your root build.Gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
Add the dependency
dependencies { implementation 'com.github.GhayasAhmad:auto-background-remover:1.0.3' }
Code:
Default
The default method for just removing the background from the subject from the bitmap without trimming the bitmap.
BackgroundRemover.bitmapForProcessing( bitmap, object: OnBackgroundChangeListener{ override fun onSuccess(bitmap: Bitmap) { //do what ever you want to do with this bitmap } override fun onFailed(exception: Exception) { //exception } } )
Trim Image
Remove the empty part of the image from the bitmap. true
for removing empty parts and false
for not and by default it is false
.
BackgroundRemover.bitmapForProcessing( bitmap, true, object: OnBackgroundChangeListener{ override fun onSuccess(bitmap: Bitmap) { //do what ever you want to do with this bitmap } override fun onFailed(exception: Exception) { //exception } } )
for more information, you can check this library on Github