Skip to content

karya-inc/ImageAnnotator

Repository files navigation

ImageAnnotator


API Kotlin

A lightweight image annotator library that allows to get Bitmap after annotation

Gradle

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>'
}

Usage

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
)

Sample App

Checkout the sample App for reference

sample2

sample1

sample1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages