A lightweight image annotator library that allows to get Bitmap after annotation
Kotlin: build.gradle.kts
dependencies {
implementation("com.github.karya-inc:imageannotator:<latest_release>")
}
Groovy: build.gradle
dependencies {
implementation 'com.github.karya-inc:imageannotator:<latest_release>'
}
Create an instance of ImageAnnotator
var resultBitmap by remember{ mutableStateOf<Bitmap?>(null) }
var resultBitmapWithoutImage by remember{ mutableStateOf<Bitmap?>(null) }
val drawableResourceId = R.drawable.dark_sample // pass the image you want to get image annotation on
val drawable: Drawable? = ContextCompat.getDrawable(LocalContext.current, drawableResourceId)
ImageAnnotation(
image = bitmap,
wantCircle = false,
wantPolygon = false,
wantDisabledDrawing = true,
wantFreeHand = true,
polygonResourceId = R.drawable.ic_polygon,
freeHandResourceId = R.drawable.ic_free_hand,
disabledDrawingResourceId = R.drawable.no_writing,
polygonSides = 5,
onDone = {
resultBitmap = it.first
resultBitmapWithoutImage = it.second
},
drawable = drawable
)
Checkout the sample App for reference