-
Notifications
You must be signed in to change notification settings - Fork 5
Image Helper
farimarwat edited this page Sep 12, 2023
·
3 revisions
ImageHelper is an extension for Document Scanner SDK to edit image with super easy method. Add signature, stickers etc
implementation 'io.github.farimarwat:imagehelper:1.0'
//Create launcher variable
lateinit var mLauncherEditImage:ActivityResultLauncher<Intent>
void onCreate(bundle:Bundle){
//Initialize the launcher
val uri = ... //get uri to the image
//Open image activity for editing
mLauncherEditImage = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
){
if(it.resultCode == ImageEditor.RESULT_OK){
val uri = it.data?.data
//Here is your edited/resulted image uri
}
}
}
val uri = ... //obtain a uri to an image which you want to edit
val intent = Intent(mContext, ImageEditor::class.java)
//set uri for intent and execute
intent.data = uri
mLauncherEditImage.launch(intent)
When activity for image editing is opened, you may found three actions to perform.
- Add (to add a sticker)
- Save (to save the image/done editing)
- Clear (to clear signature only. It will clear signature drawn by finger)